How to set a custom breadcrumb delimiter in WooCommerce?

Home » Blog » WordPress Development » How to set a custom breadcrumb delimiter in WooCommerce?

Are you looking to customize the breadcrumb navigation on your WooCommerce store? One aspect you might want to change is the delimiter, which is the character or string that separates the different sections of the breadcrumb trail.

By default, WooCommerce uses the / character as the delimiter, but it is possible to change it to any other character or string of your choice.

add_filter( 'woocommerce_breadcrumb_defaults', 'wpturbo_change_breadcrumb_delimiter' );
function wpturbo_change_breadcrumb_delimiter( $defaults ) {
    // Change the breadcrumb delimeter from '/' to '>'
    $defaults['delimiter'] = ' > ';
    return $defaults;
}

This snippet uses the woocommerce_breadcrumb_defaults filter to change the default delimiter from ' / ' to ' > ' in the breadcrumb trail. You can replace ” > ” with any other character or string to use as a delimiter.

3 responses to “How to set a custom breadcrumb delimiter in WooCommerce?”

  1. Rob Avatar
    Rob

    Implemented this quickly and easily.

    Thanks for posting it!

  2. Alex Avatar

    Thanks Rob! Glad this snippet helped you 🙂

  3. taj Avatar

    Thanks. I was looking for it until I found it. It’s a great snippet

Leave a Reply

Your email address will not be published. Required fields are marked *

Register an account to save your snippets or go Pro to get more features.