To change the WooCommerce breadcrumb text, you can use the `woocommerce_breadcrumb_defaults` filter hook to modify the default breadcrumb settings. This filter allows you to customize the breadcrumb separator and labels as per your requirement.
Here’s how you can change the WooCommerce breadcrumb text:
1. Open your theme’s `functions.php` file or a custom plugin file.
2. Add the following code to customize the breadcrumb text:
function custom_change_woocommerce_breadcrumb($args) { // Customize breadcrumb separator (optional) $args['delimiter'] = ' > '; // Customize breadcrumb labels $args['home'] = 'Custom Home'; $args['shop'] = 'Custom Shop'; $args['singular_name'] = 'Custom Item'; return $args; } add_filter('woocommerce_breadcrumb_defaults', 'custom_change_woocommerce_breadcrumb');
In this code, we use the `woocommerce_breadcrumb_defaults` filter to modify the breadcrumb settings. The `custom_change_woocommerce_breadcrumb` function receives the default breadcrumb settings as `$args`.
You can customize the following breadcrumb settings:
– `$args[‘delimiter’]`: This sets the separator between breadcrumb items. In the example, we use `’ > ‘` as the separator. You can customize it to any character or text you prefer.
– `$args[‘home’]`: This sets the label for the home link in the breadcrumb. In the example, we use `’Custom Home’`. You can change it to any custom text you want.
– `$args[‘shop’]`: This sets the label for the shop page link in the breadcrumb. In the example, we use `’Custom Shop’`. You can customize it according to your requirements.
– `$args[‘singular_name’]`: This sets the label for individual product/category pages in the breadcrumb. In the example, we use `’Custom Item’`. You can change it to any custom text you prefer.
3. Save the changes, and now the WooCommerce breadcrumb text will be customized based on the settings you defined.
With this custom code, you can change the WooCommerce breadcrumb text to suit your website’s specific needs and branding.