I’m making a woocommerce theme and I’m having trouble reordering the single page hooks. I want the product short description to appear under the product title.
I’ve been able to move the short description under the title using the remove / add action, I added this to the function.php file
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 7 );
Here’s what my content-single-product file looks like
<div class="summary entry-summary">
<?php
/**
* woocommerce_single_product_summary hook
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_excerpt - 7
* @hooked woocommerce_template_single_rating - 20
* @hooked woocommerce_template_single_price - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
do_action( 'woocommerce_single_product_summary' );
?>
The problem is now the description is showing up twice, once in the new position (under the title) and another time it’s original position (under the price)
Any help would be greatly appreciated! Thanks.
Ok I’ve been able to change the hook position in the wp-template-hooks.php file directly.
My question now is why can’t I change these by Removing/Adding actions to the functions.php file?
add this function to your theme functions.php
In case you like add some elements again, use add_action and change priorities if needed.