Hello I am trying to add content above the product tabs in woocommerce product page using hooks. I used the code below but the content shows after the products tabs I would like it to show before.
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 1 );
add_action('woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 20);
add_action( 'woocommerce_after_single_product_summary', 'my_custom_action', 15);
function my_custom_action() {
echo do_shortcode( '[su_image_carousel source="posts: recent" limit="20" slides_style="default" controls_style="dark" crop="10:16" columns="5" adaptive="yes" spacing="yes" align="none" max_width="none" captions="yes" arrows="yes" dots="no" link="none" target="blank" autoplay="5" speed="medium" image_size="full" outline="yes" class=""]');
};
I have attached image for further explanation.
Rempty answers:
Hello
the data tabs hooks priority is 10, change your code to
add_action( 'woocommerce_after_single_product_summary', 'my_custom_action', 5);
function my_custom_action() {
echo do_shortcode( '[su_image_carousel source="posts: recent" limit="20" slides_style="default" controls_style="dark" crop="10:16" columns="5" adaptive="yes" spacing="yes" align="none" max_width="none" captions="yes" arrows="yes" dots="no" link="none" target="blank" autoplay="5" speed="medium" image_size="full" outline="yes" class=""]');
};
George Sprouse comments:
Hi Rempty, I tried this code and now the content does not appear at all.
Mohamed Ahmed answers:
Hi
Could you try this code
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 1 );
add_action('woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 20);
add_action( 'woocommerce_before_single_product_summary' , 'my_custom_actiont', 30 );
Darlene Grace Arcenal comments:
Hi, Try this one
I just changed the priority numbers
<?php
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
add_action('woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 20);
add_action( 'woocommerce_after_single_product_summary', 'my_custom_action', 10);
function my_custom_action() {
echo do_shortcode( '[su_image_carousel source="posts: recent" limit="20" slides_style="default" controls_style="dark" crop="10:16" columns="5" adaptive="yes" spacing="yes" align="none" max_width="none" captions="yes" arrows="yes" dots="no" link="none" target="blank" autoplay="5" speed="medium" image_size="full" outline="yes" class=""]');
};
?>
Darlene Grace Arcenal answers:
Hi Try this one
I just rearrange the priority numbers
<?php
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
add_action( 'woocommerce_after_single_product_summary', 'my_custom_action', 10);
function my_custom_action() {
echo do_shortcode( '[su_image_carousel source="posts: recent" limit="20" slides_style="default" controls_style="dark" crop="10:16" columns="5" adaptive="yes" spacing="yes" align="none" max_width="none" captions="yes" arrows="yes" dots="no" link="none" target="blank" autoplay="5" speed="medium" image_size="full" outline="yes" class=""]');
};
add_action('woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 20);
?>