wp-config.php

For more handling over CoCart for your store or a clients store, you will find that using the wp-config.php file is the best place to setup certain conditions.

Uninstall

To prevent any data loss when uninstalling CoCart from the backend and to ensure only the site owner can perform this action. You need to enable the ability to uninstall completly before uninstalling CoCart.

<?php
/**
 * Allows the full un-installation of CoCart.
 */
define( 'COCART_REMOVE_ALL_DATA', true );

White Labelling

If you are developing a headless store for a client and need to hide CoCart. Enabling white label mode comes in handy if that is something you would need.

Enabling this hides CoCart completely from the backend including the admin menu, plugin row links, plugin notices, WooCommerce inbox notices and WooCommerce System Status information.

<?php
/**
 * Hides CoCart from the WordPress dashboard.
 */
define( 'COCART_WHITE_LABEL', true );

Load Cart for the Web

Introduced filter since v2.8.2

In addition to white labelling, you can filter the parameter name cocart-load-cart to what ever you like.

<?php
/**
 * Change the parameter name for loading the cart via the web.
 */
add_filter( 'cocart_load_cart_query_name', function() { return 'my-cart'; });

Obviously this is not to be applied to your wp-config.php file but rather added using a snippet plugin.

WooCommerce Log Handler

If you are debugging CoCart during your development, we personally like to change the WooCommerce log handler to be stored via the database.

You can do the same by adding this to your wp-config.php file.

<?php
define( 'WC_LOG_HANDLER', 'WC_Log_Handler_DB' );

Was this helpful to you?