Created
April 14, 2024 05:08
-
-
Save shameemreza/3868f585994d27be41756405fa70db20 to your computer and use it in GitHub Desktop.
Consistently display the stock status on the Single Product page in WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( ‘woocommerce_get_availability’, ‘custom_override_get_availability’, 10, 2); | |
// The hook in function $availability is passed via the filter! | |
function custom_override_get_availability( $availability, $_product ) { | |
if ( $_product->is_in_stock() ) $availability[‘availability’] = __(‘In stock’, ‘woodmart’); | |
return $availability; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment