Sajid anwar
Sajid anwar

Reputation: 1194

Display product price under the product image

In WooCommerce, I would like to display product varation price under image. I am using some code in my functions.php but not working please any help will be appreciated. Thanks

add_action( 'woocommerce_product_thumbnails','woocommerce_single_variation',30 );

enter image description here

Upvotes: 2

Views: 1744

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253869

For that you need to:

Remove the woocommerce_template_single_price in woocommerce_single_product_summary hook:

/**
 * 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
 */

To add it in woocommerce_before_single_product_summary hook:

/**
 * woocommerce_before_single_product_summary hook.
 *
 * @hooked woocommerce_show_product_sale_flash - 10
 * @hooked woocommerce_show_product_images - 20
 */

So your code will be:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_product_thumbnails','woocommerce_template_single_price', 30 );

This code goes in function.php file of your active child theme (or theme) or also in any plugin file.

This code is tested and works.

Upvotes: 2

Related Questions