New Landing How can we help? Atelier Change Unit Price in Cart

Viewing 10 posts - 1 through 10 (of 10 total)
  • Posted in: Atelier
  • #271245
    Katie Sutton
    Member
    Post count: 104

    Hello,
    Trying to rid my cart of the Unit Price “free” verbiage when a product is $0 – it needs to say nothing for legal reasons – and I’m pounding my head against the wall.
    I have tried various snippets from Woocommerce, including this below in my child theme functions file (referencing the product ID of my product) along with a lot of other ideas but nothing seems to work!

    function sv_change_product_price_cart( $price, $cart_item, $cart_item_key ) {
    if ( 550 === $cart_item[‘product_id’] ) {
    $price = ”;
    }
    return $price;
    }
    add_filter( ‘woocommerce_cart_item_price’, ‘sv_change_product_price_cart’, 10, 3 );

    When I inspect your cart.php override template it seems like this should work but it does not. The product has variations and I even tried to use variation id instead of Post Id and still no dice. Any chance you can help with this? I need to get that “free” word out of there.
    Thanks,
    Katie

    #271265
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.

    add_filter('woocommerce_free_price_html', 'changeFreePriceNotice', 10, 2);
     
    function changeFreePriceNotice($price, $product) {
    	return 'FREE';
    }

    Thanks
    Mohammad

    #271364
    Katie Sutton
    Member
    Post count: 104
    This reply has been marked as private.
    #271367
    Katie Sutton
    Member
    Post count: 104
    This reply has been marked as private.
    #271394
    Katie Sutton
    Member
    Post count: 104
    This reply has been marked as private.
    #271450
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Do you want to change Free to $0?
    Thanks
    Mohammad

    #271474
    Katie Sutton
    Member
    Post count: 104
    This reply has been marked as private.
    #271502
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please remove my previous code and use this new code:-

    add_filter('woocommerce_free_price_html', 'changeFreePriceNotice', 10, 2);
     
    function changeFreePriceNotice($price, $product) {
    	return '$0';
    }

    Thanks
    Mohammad

    #271552
    Katie Sutton
    Member
    Post count: 104

    Unfortunately, this code is already in my functions.php and does not change the word Free when it appears in the Cart and cart dropdown as per my screenshots. I cannot figure out what drives that.

    I also have this code already in my function.php:
    add_filter( ‘woocommerce_variable_free_price_html’,’hide_free_price_notice’ );

    add_filter( ‘woocommerce_free_price_html’,’hide_free_price_notice’ );

    add_filter( ‘woocommerce_variation_free_price_html’,’hide_free_price_notice’ );

    /**
    * Hides the ‘Free!’ price notice
    */
    function hide_free_price_notice( $price ) {

    return ”;
    }

    None of this hides the Free in the cart.
    TIA,
    Katie

    #271560
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use this plugin https://wordpress.org/plugins/real-time-find-and-replace/ to replace the Free text with any text. It will really help you.
    Thanks
    Mohammad

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register