• hi,

    how can we add custom section before related product in Woocommerce single product page using hook and shortcode?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Related products are hooked to woocommerce_after_single_product_summary with a priority 20, so you can use priority 16-19 and add your code to the same hook.

    <?php
    	/**
    	 * woocommerce_after_single_product_summary hook.
    	 *
    	 * @hooked woocommerce_output_product_data_tabs - 10
    	 * @hooked woocommerce_upsell_display - 15
    	 * @hooked woocommerce_output_related_products - 20
    	 */
    	do_action( 'woocommerce_after_single_product_summary' );
    ?>
    • This reply was modified 7 years, 7 months ago by Maciej Swoboda. Reason: better code
    Thread Starter souravkr

    (@souravkr)

    Hi Maciek,

    I am trying following code, but not working….

    function myfun() {
    echo “Code for output”;
    }
    add_action( ‘woocommerce_after_single_product_summary ‘, ‘myfun’, 16 );

    thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add Custom Section Before Related Product in Woocommerce Single Product Page’ is closed to new replies.