Tagged: woocommerce
-
AuthorPosts
-
May 31, 2016 at 8:44 am #640744
Hi Kriesi
On my discounted products i wish to add the word “from” infront of the price on the single product view
and on the shop overview page.
woocommerce" />I use Woocommerce Dynamic Pricing for the discounts and they are variable products.
Could you point me to a link showing how to accomplish this?Thanks a mill
- This topic was modified 8 years, 6 months ago by waveshaper.
May 31, 2016 at 9:13 am #640751I followed this tutorial, however i only need the “from” text to display in front of discounted products not all of them….
This tutorial adds custom text to all products.
Can you help me out here?
thanksMay 31, 2016 at 9:40 am #640771So, i added the snippet
add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2); function custom_variation_price( $price, $product ) { $price = 'From: '; $price .= woocommerce_price($product->max_variation_price); return $price; }
to my child theme’s funtions.php
and it worked, however a new situation occurred, so i have products i sell in bundles of 20/40/60
as the bundle you buy is bigger the price drops lower. Now the price displayed is from the highest amount and not the lowest amount,
it displays “From $9.90” instead of “From $8.40”any ideas how i can manage it to show “from” “the lowest price” ?
Thanks- This reply was modified 8 years, 6 months ago by waveshaper.
June 1, 2016 at 5:34 am #641210Hi,
Thank you for using Enfold.
Please replace the code with the following:
add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2); function custom_variation_price( $price, $product ) { $price = 'From: '; $price .= woocommerce_price($product->min_variation_price); $price .= ' - '; $price .= woocommerce_price($product->max_variation_price); return $price; }
Best regards,
IsmaelJune 1, 2016 at 9:20 am #641332Hi Ismael
Wow, you guys truly go the extra mile, thank you for looking into this.
Well the snippet made a difference but still now it shows From the highest price to the highest price e.g.
“From: £9.90 – £9.90”If you think you now how to fix this it would be great, otherwise, this is not your template’s issue but a plugin issue so i understand
if you choose to leave it.Cheers
June 3, 2016 at 4:22 am #642349Hi,
It is working properly on our installation. Screenshot here: http://imgur.com/hjU6gcD
Please post the login detail here so that we can check the settings.
Best regards,
IsmaelJune 3, 2016 at 8:54 am #642460Hi Ismael
I see it works on your side, very strange.
Thank you for looking into this, much appreciated, login is in the private content.
CheersJune 4, 2016 at 7:45 am #642854Hi!
We checked the variations of the product above and the price are all set to 9.90. http://florianschulze.com/enduredesfin/wp-admin/post.php?post=869&action=edit&lang=en
Best regards,
IsmaelJune 4, 2016 at 5:19 pm #642964Hi Ismael
Thank you for going the extra mile.
It works now.
CheersJune 5, 2016 at 2:18 am #643039September 29, 2016 at 2:05 pm #693100Would it be possible to use the same for simpel products?
The current code only seems to work for Variable products.September 29, 2016 at 2:15 pm #693108Edit: The following code is wrong because it changes all normal priced products also…
Nevermind I found it by trial and error:
// Edit from and to price for simple products add_filter('woocommerce_get_price_html', 'custom_price', 10, 2); function custom_price( $price, $product ) { $price = 'From: '; $price .= woocommerce_price($product->regular_price); $price .= ' - '; $price .= woocommerce_price($product->sale_price); return $price; }
- This reply was modified 8 years, 2 months ago by mikehenze.
October 1, 2016 at 6:17 am #694149 -
AuthorPosts
- The topic ‘Add text "from" to price of discounted products in WooCommerce’ is closed to new replies.