Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Brandon Kraft

    (@kraftbj)

    Code Wrangler

    Jetpack adds the sharing buttons, by default, by hooking on to the_content and the_excerpt within WordPress via

    add_filter( 'the_content', 'sharing_display', 19 );
    add_filter( 'the_excerpt', 'sharing_display', 19 );

    Typically, the priority of 19 is high enough to go after all content (which is typically placed at level 10).

    In this case, from a quick skim of Woocommerce’s code, it looks like the category’s description will be at the top and is serving as the_content, so we’re adding ourselves after that. Then, Woo adds the actual products after that.

    To remove it, I would try something like this in your theme’s functions.php (untested code):

    function no_sharing_icons_woo_product_cat(){
    remove_filter('the_content', 'sharing_display', 19 );
    }
    add_action('woocommerce_archive_description', 'no_sharing_icons_woo_product_cat');

    This would add specifically to the “archive” pages of Woo (product category and tags) a request to remove the Jetpack added sharing links while it shouldn’t impact the rest of your site.

    Cheers!

    Thread Starter bulewold

    (@bulewold)

    I’ll try this.
    Thank you.

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

The topic ‘Sharing button on product category’ is closed to new replies.