Home Forums WoodMart support forum zero price products

zero price products

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #188336

    I need to show a lable insted of $0.00 price like “FREE” and have the add to cart button like a normal product.

    Cand you help me?

    Thanks

    #188357

    Hello,

    Woocommerce does not provide such an option, unfortunately. You can create an attribute and create a “Free” attribute item, add it to the product and enable “Show attribute label on products” in Products > Attributes > enter the attribute which you have created. You will get the label on the product and your price. The product would be added without any problems.

    You will need to hide the existing label:

    Please add this code to the Theme Settings > Custom CSS > Global:

    body .labels-rectangular .onsale { 
    display:none; 
    }

    Best Regards

    #188362

    Ive used that code to solve it.

    Thanks

    
    add_filter( 'woocommerce_get_price_html', 'bbloomer_price_free_zero_empty', 9999, 2 );
       
    function bbloomer_price_free_zero_empty( $price, $product ){
        if ( '' === $product->get_price() || 0 == $product->get_price() ) {
            $price = '<span class="woocommerce-Price-amount amount">FREE! OR TEXT YOU WANT</span>';
        }  
        return $price;
    }
    #188468

    Hello,

    Thank you for sharing. If you have any questions please feel free to contact us.

    Best Regards

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