Home Forums WoodMart support forum exclude specific products from show price and add to cart

exclude specific products from show price and add to cart

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

    giannisth
    Participant

    hi, in https://www.kasareviews.com/woocommerce-hide-price-for-specific-product-category-user-roles-guests/ i read about inserting this code in function.php in order to exclude specific products from show price and add to cart

    /*exclude specific products to not show price*/
    add_filter( ‘woocommerce_get_price_html‘, function( $price, $product ) {
    $hide_for_products = array( 8105620 );
    if ( in_array( $product->get_id(), $hide_for_products ) ) {
    return ‘‘;
    }

    when i apply it though, the site crashes.any idea of what i am doing wrong and if alternativelly there is a fix for this?
    P.S the product id is 8105620 or 1606120984 at the end of the url?
    thanks a lot!

    #243996

    Hello,

    Most likely the code is out-to-dated or harmful. please remove it. Try to find the plugin which provides the option without any code inserting.

    Best Regards

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