mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
6 lines
189 B
Text
6 lines
189 B
Text
add_filter( 'woocommerce_add_to_cart_validation', function( $passed, $product_id, $quantity ) {
|
|
if( ! WC()->cart->is_empty()) {
|
|
WC()->cart->empty_cart();
|
|
}
|
|
return $passed;
|
|
}, 20, 3 );
|