How to reorder WooCommerce’s single product template
We can see that, for example, the ‘woocommerce_single_product_summary’ hook includes the code that generates the product title, price, add-to-cart and meta (category and tags), amongst others.
Notice the numbers
<span class="token comment" spellcheck="true">/** * woocommerce_single_product_summary hook * * @hooked woocommerce_template_single_title - 5 * @hooked woocommerce_template_single_rating - 10 * @hooked woocommerce_template_single_price - 10 * @hooked woocommerce_template_single_excerpt - 20 * @hooked woocommerce_template_single_add_to_cart - 30 * @hooked woocommerce_template_single_meta - 40 * @hooked woocommerce_template_single_sharing - 50 */</span> <span class="token function">do_action</span><span class="token punctuation">(</span> <span class="token string">'woocommerce_single_product_summary'</span> <span class="token punctuation">)</span><span class="token punctuation">;</span>
Each number is an order positon inside the hook. The lower the number, the earlier it appears in the layout.
<span class="token comment" spellcheck="true">// Add product meta in new position</span> <span class="token function">add_action</span><span class="token punctuation">(</span> <span class="token string">'woocommerce_single_product_summary'</span><span class="token punctuation">,</span> <span class="token string">'woocommerce_template_single_meta'</span><span class="token punctuation">,</span> <span class="token number">5</span> <span class="token punctuation">)</span><span class="token punctuation">;</span>