Hide out of stock product button
Wed Nov 10 2021 07:14:11 GMT+0000 (Coordinated Universal Time)
Saved by
@itaiki
/**
* Hide out of stock product button.
*
* @param string $html
* @param WC_Product $product
* @param array $args
* @return string
*/
function ace_remove_out_of_stock_product_button( $html, $product, $args ) {
if ( ! $product->is_in_stock() && ! $product->backorders_allowed() ) {
return '';
}
return $html;
}
add_filter( 'woocommerce_loop_add_to_cart_link', 'ace_remove_out_of_stock_product_button', 10, 3 );
content_copyCOPY
Comments