Home / Forums / WoodMart support forum / Price range (variable products)
Home › Forums › WoodMart support forum › Price range (variable products)
Price range (variable products)
- This topic has 6 replies, 2 voices, and was last updated 1 year, 6 months ago by
Aizaz Imtiaz Awan.
-
AuthorPosts
-
December 24, 2024 at 11:12 am #625018
john_charalambidisParticipantHie.
We have set a new store, there are many variable products with wide range of prices depending on the sizes, we would like to have the option to apply to all variable products a name “From-To” e.g (Room Divider – A breath of summer “From 192,19 € To: 362,07 €” .
The template itself have the option to show the range of prices, but without mentioning “From-To” there are misunderstandings.Thanks in advance.
December 24, 2024 at 11:28 am #625021
john_charalambidisParticipantFor the time being, we have set ( “Hide “to” price) for Variable products, to avoid issues with costumers, since they thought it was wrong price input.
I will add the Screenshots–>
Attachments:
You must be logged in to view attached files.December 24, 2024 at 4:35 pm #625135Hello,
To add “From-To” before the price range on variable products, you can use the following custom code in your child theme’s functions.php file:
add_filter('woocommerce_variable_price_html', 'custom_variable_price_format', 10, 2); function custom_variable_price_format($price, $product) { $min_price = wc_get_price_to_display($product, ['price' => $product->get_variation_price('min')]); $max_price = wc_get_price_to_display($product, ['price' => $product->get_variation_price('max')]); $price = sprintf(__('From %s To %s', 'woocommerce'), wc_price($min_price), wc_price($max_price)); return $price; }This will display the price range in the “From-To” format for all variable products.
Best Regards
December 25, 2024 at 2:19 am #625201
john_charalambidisParticipantThanks for your support.
It worked perfect !! , but we prefer instead of showing from – to, showing only the starting price “From”. We have few products that belong to variable products with same price range and it looks a mess, and sounds like a better marketing idea.Could you please reproduce the code with these characteristics only “From” ?
Thanks in advance.December 25, 2024 at 11:05 am #625240Hello,
You can use the following custom code in your child theme’s functions.php file:
add_filter('woocommerce_variable_price_html', 'custom_variable_price_from', 10, 2); function custom_variable_price_from($price, $product) { $min_price = wc_get_price_to_display($product, ['price' => $product->get_variation_price('min')]); $price = sprintf(__('From %s', 'woocommerce'), wc_price($min_price)); return $price; }Best Regards
December 25, 2024 at 10:05 pm #625355
john_charalambidisParticipantThank you so much.
it worked perfectly.
Merry Christmas and all the bestDecember 26, 2024 at 9:58 am #625389Most Welcome!!!.
I’m so happy to hear you are pleased with the Theme and Support. XTEMOS strives to deliver the best customer experience, and it makes our day to hear we have accomplished that.
We count ourselves lucky to have you as a customer. You can always reach us at any time. We are always here to help you.
Thanks for contacting us.
Have a great day.Topic Closed.
Best Regards. -
AuthorPosts
The topic ‘Price range (variable products)’ is closed to new replies.
- You must be logged in to create new topics. Login / Register