How to move the product meta to the beginning of the product description tab?
I try:
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
add_action( 'woocommerce_product_tabs_description', 'woocommerce_template_single_meta', 10 );
Remove works, but add_action()
doesn’t.
2
Answers
You can keep the first code line. Then to insert single product meta on product description tab, before description, you can use 2 different ways:
1). Using Hooks as follows:
Code goes in functions.php file of the active child theme (or active theme). Tested and works.
2). Or Overriding templates:
You can override
single-product/tabs/description.php
template file via your theme as explained in this official documentation.Once you have copied the file to the
woocommerce
folder inside your active theme, open editsingle-product/tabs/description.php
file and add the following line inside it:It will displays the product meta information inside the product description tab.
Don’t forget to keep in your active child theme’s functions.php file:
Related: WooCommerce action hooks and overriding templates
There actually is a way to do this within your functions without copying files from
woocommerce
and overriding them in your child theme.Per WooCommerce documentation, you can customize the product data tabs. With a small modification to the code they provided, you can do what you’re asking: