• Resolved Group Of Oceninfo

    (@princebhalani143)


    Hello Team,

    I have done lots of research on google but not able to find the perfect solution for the below changes.

    I want to change attribute breadcrumb second array text from “Product Collections” to “Collections” (Please see image for detailed info: https://imgur.com/a/QM6l8r7

    Current Result: Home > Product Collections > Entertain in Style
    After update need something like : Home > Collections > Entertain in Style

    Ref link: https://docs.woocommerce.com/document/customise-the-woocommerce-breadcrumb/

    Every solution is showing how to update home text but not showing for other text I have also tried below code but not working as I am missing on specific hook

    add_filter( 'woocommerce_breadcrumb_defaults', 'wcc_change_breadcrumb_home_text' );
    function wcc_change_breadcrumb_home_text( $defaults ) {
        // Change the breadcrumb home text from 'Home' to 'Apartment'
    	$defaults['product collections'] = 'Collections';
    	return $defaults;
    }
    add_filter( 'woocommerce_breadcrumb_defaults', 'wcc_change_breadcrumb_home_text', 20 );
Viewing 8 replies - 1 through 8 (of 8 total)
  • jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @princebhalani143 Can you clarify what type of page that is on? By default the WooCommerce breadcrumb will display category names without adding “collections” to the name. Would you be able to provide a link to the page you are working on?

    Thread Starter Group Of Oceninfo

    (@princebhalani143)

    @jessepearson Thanks for your reply, It’s WooCommerce Attributes Collection page Please have a look on https://goo.gl/b8RDGw

    Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    “Product Collections” is generated dynamically based on the category name – is “Product Collections” the exact name of one of your categories? If so, why not just rename the category to “Collections”?

    Thread Starter Group Of Oceninfo

    (@princebhalani143)

    Category name is supplied as Collections only, As it’s Attribute so Attribute name is supplied as “Collections” but it’s adding Product + Attribute Name in Breadcrumb

    So, For other attributes I have checked it’s also coming up like Product + Attribute Name instead of Attribute name only.

    Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    @princebhalani143 – I’m confused as to how your “attributes” are being displayed within the Breadcrumbs as they’re not part of the Breadcrumbs output by default. Are you using any kind of customizations for the Breadcrumbs or a plugin that modifies its behavior? If you’re not testing this with the default Storefront theme, please also test with it.

    How exactly did you create this page? It doesn’t seem to be part of the standard Shop hierarchy, is it a custom page using a shortcode or something?
    https://www.powderlife.com/find/collections/entertain-in-style/

    Thread Starter Group Of Oceninfo

    (@princebhalani143)

    @shellbeezy: Thanks for your response, I have created all the attributes in the normal way how we’re creating in WooCommerce.

    Products > Attributes > Create New Attribute > Open Created Attribute > Configure terms accordingly.

    Might be theme developer created some hack, I have to check into the theme files.

    I have tested on development platform using Storefront theme it’s showing normal.

    If you know any overwriting method like I have mentioned before then you can suggest some hook otherwise all good, I’ll find some way and update answer here accordingly.

    Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    @princebhalani143 – this certainly looks to be something custom-developed given that it works properly with a default theme. I don’t know of a hook that could override the display of the children(only the home title), perhaps the theme is not actually using the standard filter anyways?

    Thread Starter Group Of Oceninfo

    (@princebhalani143)

    Hi @shellbeezy,

    As of now I have supplied something like below on that page so on load it’ll remove product from the code or page.

    <script>
    jQuery(document).ready(function(){
    	$("*").contents().each(function() {
    	if(this.nodeType == 3)
    		this.nodeValue = this.nodeValue.replace("Product", "");
    	});
    });
    </script>

    It’s not the perfect solution but as of now it’s working as expected.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘How to change breadcrumb second array?’ is closed to new replies.