Adding Shop link in breadcrumbs without changing permalinks

#615058
  • Resolved Anonymous
    Rank Math free

    Hi.
    I am using Blocksy theme along with RankMath SEO plugin for my ecommerce store. I am facing a problem with the breadcrumbs which is originated by the woocommerce developers actually, there were a few custom code solutions available for the woocommerce plugin file, but since I am using RankMath’s breadcrumbs on my website, and I am not a coder. I am looking for your assistance on this.

    So the problem is, the breadcrumbs are currently like this “Home > Current Page” no matter which category/subcategory you’re in. I want make those breadcrumbs properly structured without changing permalinks as that will impact my seo. So for example, This is a product category, Its showing as Home > Category Name. I want it to be like Home > Shop > Category Name.
    Similarly, the single product page also shows Home > Product Name, But I’d like to get it structured like Home > Shop > Category Name > Product Name but without changing the permalinks and they are already ranked.

    People on internet told we gotta edit the code to do it, But I simply could not do it due to lack of coding knowledge. Can you somehow help me solve this problem? I would really appreciate it.
    Thanks

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

    Thanks for contacting us and sorry for the inconvenience caused.

    You will have to add the following filter to your site to add the Shop in the breadcrumbs without changing the permalinks:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
            $shop = ['Shop',
    		 'https://yourdomain.com/shop' //replace with the shop URL
    		];
            if(is_woocommerce()) { 
                array_splice( $crumbs, 1, 0, array($shop) );
    	    return $crumbs;
            }
    	return $crumbs;
    }, 10, 2);

    Here is how to add a filter to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    To add the category, please navigate to WP Dashboard > Rank Math SEO > Titles & Meta > Products and select Product Categories as the Primary Taxonomy of the page. If a product belongs to multiple categories, then you will have to choose the category you want to use in breadcrumbs as the primary category. Here is a guide that can help: https://rankmath.com/kb/how-to-choose-a-primary-category/

    Hope that helps. Let us know if you need any other assistance.

    Anonymous
    Rank Math free

    Hi. I am really thankful for your support. The code worked like a charm.
    Really appreciate it. Thanks alot! 🙂

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘Adding Shop link in breadcrumbs without changing permalinks’ is closed to new replies.