לאפשר רק מוצר אחד בעגלת קניות

PHOTO EMBED

Tue Oct 12 2021 09:53:37 GMT+0000 (Coordinated Universal Time)

Saved by @Shesek

/* Clear cart data before adding new */ // before addto cart, only allow 1 item in a cart
 add_filter( 'woocommerce_add_to_cart_validation', 'woo_custom_add_to_cart_before' ); function woo_custom_add_to_cart_before( $cart_item_data ) { global $woocommerce; $woocommerce->cart->empty_cart(); // Do nothing with the data and return return true; }
content_copyCOPY

קרדיט: שמעון סביר