Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #308509

    Hi guys, really loving the theme and learning to tweak things as needed. What I’d like to do is to add the integrated social buttons on Woocommerce product pages. I’ve already figured out how to do this on regular pages and portfolio pages in addition to posts using this:

    https://kriesi.at/support/topic/share-icons-on-pages-and-portfolio-items/

    However, the code for this won’t work on Woocommerce product pages because it refers to inserting the social buttons after the Avia builder code that isn’t enabled on on Woocommerce product pages. Can you please let me know how I might go about doing this? Or alternatively how to turn the social buttons into a shortcode that could be embedded into each product page.

    Thanks very much in advance! : )

    #308519

    Hey!

    Try with this:

    add_action('ava_after_content', 'avia_add_social_toolbar', 10, 2);
    function avia_add_social_toolbar($id = "", $context = "")
    {
    	if($context == "page" || $context == "single-portfolio" || $context == "product")
    		avia_social_share_links();
    }
    

    Cheers!
    Josue

    #308602

    Thanks for your response, but unfortunately that code doesn’t work. I also just updated to the latest version of enfold to see if that might be the issue, however the code still doesn’t work. To be clear, it does work on pages and portfolio items, but not for products. Any other suggestions?
    I forgot to mention that I’m using a child theme, so the code is partially successful when put in the child theme’s functions.php.

    #308624
    This reply has been marked as private.
    #308639

    Hi!

    Try with this code instead:

    add_action('woocommerce_after_single_product_summary', 'avia_add_social_toolbar', 10, 2);
    function avia_add_social_toolbar($id = "", $context = "")
    {
    		avia_social_share_links();
    }

    And add this to the Quick CSS:

    .single-product .av-share-box {
        margin-bottom: 20px;
    }

    Cheers!
    Josue

    #309515

    Thank you Josue, that worked beautifully. All I had to change was the function name used in my previous code (used to make the social buttons appear on pages and portfolio items) so there wasn’t a clash/error due to the repeat use of the function name. Looks great now!

    Thanks again,
    Crys :)

    #309523

    You are welcome Crys, glad to help :)

    Regards,
    Josue

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Social buttons on woocommerce product pages’ is closed to new replies.