Reputation: 13896
In a Woocommerce Product Page: how to change position of 'short description', 'price' and 'variation description'?
I need to put the 'Product short description' above the 'Price' and the 'Variation Description' just below the Price.
This is what I have right now:
Upvotes: 2
Views: 7991
Reputation: 29650
If you look at https://github.com/woocommerce/woocommerce/blob/3.8.0/templates/content-single-product.php#L47 you'll see that the product summary is constructed using hooks with different priorities.
&
so you can just swap the values
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 20 );
function move() {
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10 );
add_action( 'woocommerce_before_variations_form', 'woocommerce_single_variation', 10 );
}
add_action( 'woocommerce_before_add_to_cart_form', 'move' );
Upvotes: 3
Reputation: 156
normaly you will find different hooks / different priorities in the templates folder of woocommerce.
In the content-single-product.php inside you will find some comments like:
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
To modify create an new ordering in the functions.php of the child theme like this
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);
add_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 30);
add_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 20);
Upvotes: 0