• Resolved pickme

    (@pickme)


    Hello,

    Using plugin The SEO Framework, from product page I have set a child category as the primary one to a product. Moreover, I have assigned to it 3 more child categories. As a result, I expected the Woocommerce Products Category widget to display the primary category (highlight it as the one the product is assigned to) and not one of the other ones (not primary). Breadcrumbs and url at product page are correct.

    I have found this issue but could not apply the fix:
    https://github.com/woocommerce/woocommerce/issues/10555

    Could you please help resolve this issue?
    Thank you

    • This topic was modified 4 years, 6 months ago by pickme.
    • This topic was modified 4 years, 6 months ago by pickme.
    • This topic was modified 4 years, 6 months ago by pickme.
    • This topic was modified 4 years, 6 months ago by pickme.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    As you’ve spotted correctly, TSF does augment the breadcrumbs and post type link.

    Truthfully, I didn’t even know WooCommerce had a widget–so, I never implemented primary terms for it. But we should. So, I added a feature request, and I hope to ship it with the next update (4.1.1, if everything goes well!): https://github.com/sybrew/the-seo-framework/issues/544

    In the meantime, I think this filter will address the issue. Please note it makes uses of a “private, underscored” method–which means I do not report on changing the method’s behavior.

    add_action( 'woocommerce_init', function() {
    
    	$tsf = function_exists( 'the_seo_framework' ) ? the_seo_framework() : null;
    
    	if ( $tsf ) {
    		add_filter( 'woocommerce_product_categories_widget_main_term', [ $tsf, '_adjust_post_link_category' ], 10, 2 );
    	}
    } );

    I recommend removing that filter before updating to the next version of TSF. I’ll notify you here when it’s ready ??

    Thread Starter pickme

    (@pickme)

    Hi @cybr!

    That filter fixes the issue! This was exactly the issue I described.

    As a result, by setting a primary category (even child category) to a product, the default Woocommerce product category widget on the sidebar of the single product page highlights the same primary category and not other categories (also set to same product).

    You have already fixed the product permalink and breadcrumb according to primary product category.

    Well done!!

    • This reply was modified 4 years, 6 months ago by pickme.
    • This reply was modified 4 years, 6 months ago by pickme.
    • This reply was modified 4 years, 6 months ago by pickme.
    Plugin Author Sybre Waaijer

    (@cybr)

    Awesome ?? I’m glad it worked first-time!

    May I ask you to leave a review about TSF here? It’d really help us out! Thanks ??

    Thread Starter pickme

    (@pickme)

    Hello @cybr,

    Of course! You solved an issue that has been around for years in less than an hour.
    I have installed TSF and using it from now on!
    Bravo!
    ??

    • This reply was modified 4 years, 6 months ago by pickme.
    Plugin Author Sybre Waaijer

    (@cybr)

    My pleasure! And thank you so much for the kind review! ??

    I’ll keep you posted on when we integrate this as a feature. Cheers!

    Thread Starter pickme

    (@pickme)

    I appreciate that!

    You are always welcome!

    ??

    • This reply was modified 4 years, 6 months ago by pickme.
    Plugin Author Sybre Waaijer

    (@cybr)

    Quick status update: TSF v4.1.1 will include this feature. You can safely remove the custom filter from my first reply to this topic after you update the plugin.

    Thread Starter pickme

    (@pickme)

    Hi Sybre!

    Thank you very much for this reminder! ??

    Regards!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Woocommerce Products Category widget Primary Category’ is closed to new replies.