Home Forums WoodMart support forum Hide Price for Specific Product CSS

Hide Price for Specific Product CSS

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #585304

    wima
    Participant

    HI,
    is it possible to hide the Price for a specific Product ?

    Maybe with a CSS Code or a list ?

    Thank you

    #585345

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Please try to add the code below in the functions.php file in your child theme.

    add_filter( 'woocommerce_get_price_html', 'hide_price_product_ids', 10, 2 ); 
    function hide_price_product_ids( $price, $product ) {
        $hide_for_products = array( 29773, 29776 );
        if ( in_array( $product->get_id(), $hide_for_products ) ) {
            return '';
        } else { 
            return $price; // Return price for all the other products 
        }
    }

    Change the Product IDs 29773, 2976 with your own.

    Best Regards.

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