How to enable Template Debug Mode in WooCommerce

Since WooCommerce 3.0 there is no template debug mode option anymore. Instead add this to your wp-config.php
define( 'WC_TEMPLATE_DEBUG_MODE', true );

WooCommerce has two very nice debug features often overlooked. One of them being the Template Debug mode. This tool will disable template overrides for logged-in administrators for debugging purposes and should always be tried out as a first step, when dealing with WooCommerce issues related to layout and content. It is also very helpful when checking for conflicts.

Many themes overwrite WooCommerce template files.

How to increase memory limit in WordPress

We have all seen it at some point. While trying to use a feature in WordPress, this message emerges: “Fatal error: Allowed memory size of 12345678 bytes exhausted…”

WordPress memory consumption increases with the amount of modifications. The more plugins you install and keep activated , the more memory power your site needs.

As a first step of solving this, you need to know where you are at.
I use: for this.
It adds a new dashboard widget, that also displays the amount of memory allocated.

Screenshot of the WP Serverinfo dashboard widget.

Duplicate images when using WooCommerce Product CSV Import Suite

When using WooCommerce Product CSV Import Suite you may at one point find yourself with duplicated images in your media library.

WooCommerce has an FAQ here that explains how to avoid physical duplication of image files on your server.

The images will still always be duplicated in your Media Library though, here is why.

The extension uses the WP importer. The WP importer dictates a 1:1 relationship of product and image. We have yet to find a way to circumvent this.

How to enable WordPress debug mode

Normally WordPress suppresses most PHP warnings and errors. WordPress debug mode displays error messages that are vital for troubleshooting.
You can find detailed info in the WordPress codex.

Enable WP_DEBUG manually

My preferred method of enabling debug mode is manually via editing the wp-config.php file. Add these lines before /* That’s all, stop editing! Happy blogging. */

Enable WP_DEBUG with a plugin

You can also use a plugin called simply “debug”.

How to use WordPress custom code snippets

Additional features and minor customisations can be achieved via the use of custom code snippets.

Use the functions.php file

These snippet go in the functions.php file of your (child) theme. You can find more info on this in the WordPress codex here:
Be careful though. Any syntax or coding error will make your site crash.

Use a functions plugin

Alternatively you can use a plugin instead: – which will not prevent the crashing.

Create your own custom plugin

Even better and more elegant. Construct this into a mini plugin.

WooCommerce Subscriptions translating the price string

Translating the WooCommerce Subscriptions price string is a frequently asked question we get in support.

EDIT: I made this into a mini plugin.

In order to achieve this you need to use a custom code snippet such as this.

function change_signup_string( $string, $product, $include ) {
// customize $string here based on $product
return $string;
add_filter( ‘woocommerce_subscriptions_product_price_string’, ‘change_signup_string’, 10, 3 );

So for example

function change_signup_string( $string, $product, $include ) {
$string = str_replace( ‘and a’, ‘maybe and’, $string );
$string = str_replace( ‘sign-up fee’, ‘or for free’, $string );
return $string;
add_filter( ‘woocommerce_subscriptions_product_price_string’, ‘change_signup_string’, 10, 3 );

Alternatively you can edit language file with –