mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
8 lines
273 B
Text
8 lines
273 B
Text
add_filter( 'woocommerce_is_sold_individually', 'wc_product_max_1_cart_stock_low', 9999, 2 );
|
|
|
|
function wc_product_max_1_cart_stock_low( $individually, $product ) {
|
|
if ( $product->get_stock_quantity() < 3 ) {
|
|
$individually = true;
|
|
}
|
|
return $individually;
|
|
}
|