• Hi,

    My website https://www.artison.in [storefront, deli theme]

    I am trying to hide price for out of stock items in product listing page. I have tried the following and they didnt work.

    1) Functions.php

    add_filter( ‘woocommerce_variable_sale_price_html’, ‘theanand_remove_prices’, 10, 2 );
    add_filter( ‘woocommerce_variable_price_html’, ‘theanand_remove_prices’, 10, 2 );
    add_filter( ‘woocommerce_get_price_html’, ‘theanand_remove_prices’, 10, 2 );

    function theanand_remove_prices( $price, $product ) {
    if ( ! $product->is_in_stock()) {
    $price = ”;
    }
    return $price;
    }

    2) Following code to style.css

    .outofstock .price{display:none}

    .outofstock .amount{display:none}

    Please note i have already remove price in single product page using code here:
    https://stackoverflow.com/questions/21761778/how-to-hide-woocommerce-out-of-stock-items-price

    I need to remove price from product listing. Please help.

    Thanks,
    -madhu

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hide Price for Out Of Stock Items’ is closed to new replies.