Add breadcrumbs to WooCommerce Category page

Hi,

I am trying to add breadcrumbs to the top of product category pages. I can’t find what the specific template is to do that too. I added this code to the top of taxonomy-product_cat.php page and put it in my pro-child theme WooCommerce folder and that didn’t do anything:

<?php woocommerce_breadcrumb(); ?>

I found this code and added it to theme function with the above breadcrumb code instead of text inserted:

function add_custom_content(){ ?>
      <?php if ( x_is_product_category() ) : ?>
      
        <div class="custom-content pam" style="text-align: center;">
    		<?php woocommerce_breadcrumb(); ?>
        </div>

      <?php endif; ?>

    <?php }

That didn’t work either. I’m in PRO theme and the shop site I’m referencing is https://groovylabinabox.com/swag-store/

Let me know if you need login information.

Thanks,
Jen

Hi Jen,

Since you are using Pro, no need for custom code. There’s Breadcrumb element you can add when you edit pro header. Edit the header assigned to this page and then add the breadcrumb element.

Also, this page: https://groovylabinabox.com/swag-store/ is not woocommerce page but rather normal page build using the content builder. That is why even if you edit the template it will not work.

Hope this helps.

Its not the actual page swag-store that needs breadcrumbs. Its the generated product category page. Here is a direct link to what I mean…I apologize for the confusion:

https://www.groovylabinabox.com/product-category/stem-swag/t-shirts/

I’d like to add breadcrumbs here. I was able to add to the single product page by adding to the template code. BUT, I can’t find what template the category pages are using to modify this one.

Thanks,
Jen

Hi Jennifer,

Try copying the \framework\legacy\cranium\headers\views\integrity\_breadcrumbs.php file to your child theme. Make sure to create the exact folders also. Then add this code at the top part of the file.

<?php if(is_woocommerce()): ?>
  
    <div class="custom-content pam" style="text-align: center;">
        <?php woocommerce_breadcrumb(); ?>
    </div>

<?php endif; ?>

Hope it works.

Nope, that didn’t work either. Any other things I can try?

Hello Jennifer,

You may use this code:

function add_custom_content(){ ?>
    <?php if ( x_is_product_category() ) : ?>
    
      <div class="custom-content pam" style="text-align: center;">
      <?php woocommerce_breadcrumb(); ?>
      </div>

    <?php endif; ?>

  <?php
}
add_action('x_after_masthead_end', 'add_custom_content');

If nothing is helping, provide us access to your site so that we can check your settings. Please create a secure note with the following info:
– Link to your site
– WordPress Admin username / password

To know how to create a secure note, please check this out: https://theme.co/apex/forum/t/how-to-get-support/288

Regards.

That did the trick! Thanks so much!!

You are most welcome!
It’s good to know that it has worked for you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.