• Resolved kristinubute

    (@kristinubute)


    HI

    My client needs to add the wording “From” in FRONT of EACH Woocommerce product …

    Example the product would show on the SHOP Page:

    From $25.00

    I will just need to ADD the wording “From” in front of the price for each individual product.

    If someone could kindly offer suggestion on HOW I would do this would be greatly appreciated.

    Thanks in advance

    Regards

    Kristin

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Beauty of Code (woo-hc)

    (@beautyofcode)

    Hey Kristin ,

    Thanks for reaching out!

    Just be sure I understand correctly, are you looking to add “From” in front of all products, including simple products, on the Shop page only?

    If so, although help with custom code is outside our scope of support, you can try the following PHP Snippet and see if it does the trick:

    // Add 'From' in front of the price on WooCommerce shop/archive pages only
    add_filter('woocommerce_get_price_html', 'add_from_before_price_on_shop');
    function add_from_before_price_on_shop($price) {
    if (is_shop() || is_product_category() || is_product_tag()) {
    return 'From ' . $price;
    }
    return $price;
    }

    You need to add the code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin.

    I’ve tested this on my end and here are the results when using the default Storefront theme:

    Hope this helps!

    Thread Starter kristinubute

    (@kristinubute)

    Hi

    That worked amazingly on shop pages !! Thanks so much.

    I also need the wording “from” on the single product page also. Is this achievable ?

    I appreciate your support.

    Thanks

    Plugin Support Beauty of Code (woo-hc)

    (@beautyofcode)

    Hey @kristinubute ,

    You’re very welcome, glad to hear it!

    I also need the wording “from” on the single product page also. Is this achievable ?

    Absolutely! Here you go:

    // Add 'From' in front of the price on WooCommerce shop, archive, and single product pages
    add_filter('woocommerce_get_price_html', 'add_from_before_price_on_shop_and_product');
    function add_from_before_price_on_shop_and_product($price) {
    if (is_shop() || is_product_category() || is_product_tag() || is_product()) {
    return 'From ' . $price;
    }
    return $price;
    }

    You’ll need to replace the previous snippet with the one above.

    This should also include “From” before the pricing on the single product page, like so:

    Hope this helps!

    Plugin Support Feten L. a11n

    (@fetenlakhal)

    Hi! We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.