Created
March 28, 2018 20:40
-
-
Save jamesgol/e6b8d029d7b87593ba12e5d814734d3a to your computer and use it in GitHub Desktop.
Keep WooCommerce from mentioning backorders unless the item is actually out of stock
This file contains hidden or 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_product_backorders_require_notification', 'jmg_backorders_notification', 10, 2 ); | |
function jmg_backorders_notification( $notify, $product = null ) { | |
if ( $product && 'notify' === $product->get_backorders() && $product->is_in_stock() ) { | |
return false; | |
} | |
return $notify; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This all came about because of this post in the WordPress.org forum https://wordpress.org/support/topic/available-on-backorder-2/