Support » Plugin: Storefront Product Sharing » Change the location of Sharing Icons

  • I want to relocate the position of “Social media icons”. I want to place them under images. Currently, they are placed under meta in the single product page.

    I am adding following actions in functions.php (child theme), but it is not working. Any help?

    /* Enter your custom functions here */
    add_action(‘woocommerce_before_single_product_summary’,
    ‘woocommerce_template_single_sharing’,30);

    // Remove Sharing icons
    remove_action( ‘woocommerce_single_product_summary’,
    ‘woocommerce_template_single_sharing’,50);

    It is not working. any help?

    • This topic was modified 2 years, 11 months ago by projects416.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Mikey Arce

    (@mikeyarce)

    Automattic Happiness Engineer

    Hi @projects416,

    > I want to relocate the position of “Social media icons”. I want to place them under images. Currently, they are placed under meta in the single product page.

    Great question! You can change the position of these using code like this:

    add_action( 'init', 'marce_sps_location_change' );
    function marce_sps_location_change() {
    	remove_action( 'woocommerce_after_single_product_summary', array( Storefront_Product_Sharing(), 'sps_product_sharing' ), 5 );
    	add_action( 'woocommerce_product_thumbnails', array( Storefront_Product_Sharing(), 'sps_product_sharing' ), 15 );	
    }

    However, if your images have a gallery below them this would not work because the woocommerce_product_thumbnails hook will display thumbnails if they exist and not anything else. What I would suggest is putting them right below the Add to Cart button using woocommerce_share instead:

    add_action( 'init', 'marce_sps_location_change' );
    function marce_sps_location_change() {
    	remove_action( 'woocommerce_after_single_product_summary', array( Storefront_Product_Sharing(), 'sps_product_sharing' ), 5 );
    	add_action( 'woocommerce_share', array( Storefront_Product_Sharing(), 'sps_product_sharing' ), 15 );	
    }

    Cheers,

    Thanks for your feedback!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change the location of Sharing Icons’ is closed to new replies.