mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
https://stackoverflow.com/questions/68456546/woocommerce-hide-product-price-when-out-of-stock-not-in-admin/68456879
6 lines
207 B
Text
6 lines
207 B
Text
add_filter( 'woocommerce_get_price_html', 'remove_price_ofs', 10, 2 );
|
|
|
|
function remove_price_ofs( $price, $product ) {
|
|
if ( ! $product->is_in_stock() && ! is_admin() ) {$price = '';}
|
|
return $price;
|
|
}
|