• Resolved Ralph

    (@ralph001)


    Hi team,

    I am trying to add social share to my WooCommerce products but the plugin does not provide that option, only option is either at the end of the page or the very beginning.

    I can use the Hook “woocommerce_share” to insert the share bar after the “woocommerce_product_meta_end” using PHP. But there is no documentation for wp-socializer for PHP.

    and none of the code snippets I tried are working.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author vaakash

    (@vaakash)

    Hi @ralph001,

    The icons should be added at the top/bottom of the post.
    Regardless of the type of post.

    If it is not working, then it must be something with the theme doing something wrong.

    The plugin uses the_content filter and inserts the icons.
    May be the theme is not using product content at all and displaying something else.

    Please share the page URL too.

    Thanks,
    Aakash

    Thread Starter Ralph

    (@ralph001)

    Hi Vaakash,

    thank you for the prompt response,

    The icons should be added at the top/bottom of the post.
    Regardless of the type of post.

    Yes, this is working. The plugin adds the social share buttons on the top and bottom.

    The plugin uses the_content filter and inserts the icons.
    May be the theme is not using product content at all and displaying something else.

    I am trying to get the social share to show up in the middle of the post within the post content without using a shortcode (if I use the shortcode then I have to add it to each post individually which would take a lot of time since there are hundreds of posts).

    The post type is a product using WooCommerce and I want the social share to show below the WooCommerce meta data instead of at the end of the page.
    https://www.businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/
    the link above shows the WooCommerce visual hooks and I want to get the share bar to show up at the woocommerce_share hook.

    Please share the page URL too.

    I currently can’t share the link.
    I am using the Divi Theme and the site is still under construction.

    Thread Starter Ralph

    (@ralph001)

    To make it even more clear,

    The below code if added to the functions.php works.
    But on the post page it is returning the shortcode in text format instead of the actual share bar.

     
    add_action( 'woocommerce_share', 'add_content_after_share_func' );
    /*
     * share bar shortcode
     */
    function add_content_after_share_func() {
    
            // Echo content.
            echo '<div> [wpsr_share_icons template="1"] </div>';
    
    }
    
    Thread Starter Ralph

    (@ralph001)

    Ok I used the do_shortcode and it worked perfectly.

    
    add_action( 'woocommerce_share', 'add_content_after_share_func' );
    /*
     * share bar shortcode
     */
    function add_content_after_share_func() {
    
            // Echo content.
            echo do_shortcode('[wpsr_share_icons template="1"]');
    }
    
    Plugin Author vaakash

    (@vaakash)

    Excellent !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘No flexibility with WooCommerce product’ is closed to new replies.