php - WooCommerce Hide Prices When Inventory is set to '0' or 'out of stock' -
i know can use css property 'visibility:hidden', hide prices on product listing page (i have assigned specific page id, on sold items page.
but on individual product page there piece of php can use says "if item out of stock/quantity set 0, hide price"?
main sold out product listing:
http://www.montagemodern.com/sold
individual out of stock product page example:
http://www.montagewestport.com/product/pair-of-glass-bubble-lamps/
try this:
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; }
http://wwweb.jextensions.com/theanand.com/blog%252fhide-price-out-of-stock-woocommerce%252f
Comments
Post a Comment