Rank Math removes “Shop” from the product category breadcrumbs

#782512
  • Resolved Raido Linde
    Rank Math free

    Hi,

    we have woo wordpress site and when we enable Rankmath breadcrumbs on product categories, then “Shop” from the breadcrumbs is being removed.

    How to keep “Shop” in the breadcrumb of woo product categories (NB! we also want to translate the “Shop” into “kakut” in the breadcrumbs, which means cakes in Finnish)

    Kind regards,
    Raido Linde

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    Thank you for reaching out to us regarding the issue with Rank Math breadcrumbs on your WooCommerce product categories.

    To keep “Shop” in the breadcrumb of WooCommerce product categories and translate it into “kakut” (cakes in Finnish), you can follow these steps:

    1. Add the following code snippet to your theme’s functions.php file:
    if( function_exists( 'icl_object_id' ) ) {
        add_filter( 'rank_math/frontend/breadcrumb/items', 'wpmlsupp_8672_fix_wc_store_breadcrumbs', 10, 2 );
    }
    
    function wpmlsupp_8672_fix_wc_store_breadcrumbs( $crumbs, $class ) {
        if ( is_product() || is_product_category() || is_product_tag() ){
            $current_language = apply_filters( 'wpml_current_language', NULL );
            $default_language = apply_filters( 'wpml_default_language', NULL );
            if ($current_language !== $default_language) {
                $shop_page_id = wc_get_page_id( 'shop' );
                $shop_page    = get_post( $shop_page_id );
    
                // Translate "Shop" to "kakut" for Finnish
                $translated_shop_name = 'kakut';
    
                $store_crumb = array (
                    '0' => $translated_shop_name,
                    '1' => get_permalink( $shop_page ),
                    'hide_in_schema' => ""
                );
                array_splice( $crumbs, 1, 0, array( $store_crumb ) );
            }
        }
        return $crumbs;
    }
    1. Replace 'kakut' with the desired translation for “Shop” in Finnish.

    By adding this code snippet, you should be able to retain “Shop” in the breadcrumbs of your WooCommerce product categories and translate it into “kakut” for the Finnish language.

    If you encounter any issues or need further assistance, please feel free to reach out to us.

    Kind regards,
    Rank Math Support Team

    Sources:
    Multilingual SEO with Rank Math SEO & WPML » Rank Math
    How to Enable Breadcrumbs on Your Website With Rank Math SEO » Rank Math
    How to Customize Breadcrumbs in Rank Math » Rank Math

    That code isn’t working.

    Hello,

    Thank you for contacting Rank Math Support.

    We logged in to your site using the information in the sensitive data section.

    We are able to replicate the issue on your website, however, we can see that there are several outdated plugins on your site including Rank Math and these may be interfering with Rank Math. Please update the plugins and themes on your website and see if that resolves the issue for you.

    We can also see that you have installed the PRO version on your website, however, the account you used to open this ticket is the FREE version.

    Can you please search and forward a receipt from FastSpring.com so we can locate your account and verify it?

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Hi,

    On our live site we have all the plugins updated but the issue is still there.

    We created a new staging copy of live site with all updated the plugins for your consideration, but the issue is still there (with same credentials).

    We hired a freelancer from a fiverr who did some work for us and installed Rank math pro for us, so we don’t have access to his account nor receipts.

    Best,
    Raido

    From astra I also received following:

    “Thank you for bringing this issue to our attention. It sounds like there might be a conflict between the Rank Math SEO plugin and the Astra theme’s breadcrumbs feature.

    To resolve this issue, I recommend reaching out to the Rank Math support team for further assistance. They may be able to provide guidance on how to configure the plugin to work harmoniously with the Astra theme’s breadcrumbs.”

    Kind regards,
    Raido

    Hello,

    Please try using this filter code to add the “Shop” item in your breadcrumbs:

    add_filter('rank_math/frontend/breadcrumb/items', function ($crumbs, $class) {
    	$shopItem = [
    		'Shops',
    		'https://helppokakku.fi/staging/shops'
    	];
    
    	if (is_product_category()) {
    		array_splice($crumbs, 1, 0, array($shopItem));
    		return $crumbs;
    	}
    	
    	return $crumbs;
    }, 10, 2);

    You may refer to this guide on how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how that goes.

    Yes, that worked. Thank you.

    Hello,

    We’re delighted to hear that this issue has been resolved. We appreciate your feedback.

    This ticket will be closed now, but if you ever have another question or need any help in the future, please don’t hesitate to create a new forum topic. We’ll be more than happy to assist you again.

    Thank you for choosing Rank Math and have a wonderful day!

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

The ticket ‘Rank Math removes “Shop” from the product category breadcrumbs’ is closed to new replies.