Moving Quantity after product description
Using woo-commerce I need to place the quantity after the description. Below attached screenshot shows expected output.
Topic woocommerce-offtopic filters customization Wordpress
Category Web
Using woo-commerce I need to place the quantity after the description. Below attached screenshot shows expected output.
Topic woocommerce-offtopic filters customization Wordpress
Category Web
Easiest way to make it done is by playing with hook priorities.
On content-single-product.php
is this comment:
/**
* Hook: woocommerce_single_product_summary.
*
* @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
* @hooked WC_Structured_Data::generate_product_data() - 60
*/
So to put something after excerpt, it needs to have the priority between 20 - 30. First of all you need to remove woocommerce_template_single_add_to_cart
which shows the quantity and add to cart button.
remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30);
Then register this same action but with higher priority which shows the quantity and add to cart button after excerpt.
add_action('woocommerce_single_product_summary',woocommerce_template_single_add_to_cart', 20);
Since you want to move just the quantity, my solution would be to register the action again .. the priority is up to you.
add_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30);
and with simple css hide the button after the excerpt and below hide the quantity.
Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.