Created
June 21, 2023 12:40
-
-
Save woogists/1e320cf196e9f09212989b0c5c7791c2 to your computer and use it in GitHub Desktop.
Display that a product is in stock even if Track Stock Quantity is not enabled under the product's Inventory tab.
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
<?php | |
add_filter( 'woocommerce_get_availability', 'custom_override_woocommerce_show_in_stock', 10, 2 ); | |
function custom_override_woocommerce_show_in_stock( $availability, $product ) { | |
if ( ! $product->managing_stock() && $product->is_in_stock() ) { | |
$availability['availability'] = __( 'In Stock', 'woocommerce' ); | |
} | |
return $availability; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment