Tagged: 

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #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.
    from text on price <a href='https://automattic.pxf.io/y2XdbN/' target='_blank' rel='nofollow'/ rel=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, 5 months ago by waveshaper.
    #640751

    I 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?
    thanks

    #640771

    So, 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, 5 months ago by waveshaper.
    #641210

    Hi,

    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,
    Ismael

    #641332

    Hi 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”

    discount variation pricing

    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

    #642349

    Hi,

    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,
    Ismael

    #642460

    Hi Ismael

    I see it works on your side, very strange.
    Thank you for looking into this, much appreciated, login is in the private content.
    Cheers

    #642854

    Hi!

    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,
    Ismael

    #642964

    Hi Ismael
    Thank you for going the extra mile.
    It works now.
    Cheers

    #643039

    Hey!

    Awesome! Let us know if you need anything else. :)

    Regards,
    Ismael

    #693100

    Would it be possible to use the same for simpel products?
    The current code only seems to work for Variable products.

    #693108

    Edit: 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, 1 month ago by mikehenze.
    #694149

    Hi,

    Great! Let us know if you need anything else. :)

    Best regards,
    Ismael

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Add text "from" to price of discounted products in WooCommerce’ is closed to new replies.