plugin development - Woocommerce Single Product Tabs Got Duplicate

admin2025-06-03  2

I have just change the order of these lines of code for some changing in single product template.

add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 10 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 15 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

After toggling the numeric digit at the first two lines i am getting duplicate tabs. If i reorder them it will revert back to the default position. Kindly assist me what can i do. Thanks

I have just change the order of these lines of code for some changing in single product template.

add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 10 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 15 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

After toggling the numeric digit at the first two lines i am getting duplicate tabs. If i reorder them it will revert back to the default position. Kindly assist me what can i do. Thanks

Share Improve this question asked Feb 8, 2019 at 18:53 Ahtsham Ul HaqAhtsham Ul Haq 11 bronze badge 5
  • It's likely because you haven't removed the default hooks, which results in the same callback being hooked twice to the same action. – Sally CJ Commented Feb 10, 2019 at 13:10
  • Hi @SallyCJ, Could please assist me which file i need to edit – Ahtsham Ul Haq Commented Feb 10, 2019 at 19:05
  • You can add the code in the theme functions file (i.e. functions.php) and have a look at this example. – Sally CJ Commented Feb 12, 2019 at 6:20
  • 1 @SallyCJ Thanks a lot for help but that not work me, i dont know why but the good thing is i have fixed it through css to display:none the first child and works great. – Ahtsham Ul Haq Commented Feb 12, 2019 at 8:23
  • Ok then. But you should post an answer - and accept it - so that people know the question has an accepted solution. :) All the best. – Sally CJ Commented Feb 12, 2019 at 10:15
Add a comment  | 

1 Answer 1

Reset to default 0

Found a quick solution for this problem. Unable to remove action as Sally mentioned above with example.For me the display:none; is enough, i have remove the child div of summary class. See the code below:

.summary.entry-summary div:nth-child(5) {
    display: none;
}

For me its 5th child maybe it will help others.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748915891a314785.html

最新回复(0)