@@ -64,7 +64,7 @@ public function add_to_cart( $request ) {
6464 __ ( '"%s" is already inside your cart. ' , 'woo-gutenberg-products-block ' ),
6565 $ product ->get_name ()
6666 ),
67- 403
67+ 400
6868 );
6969 }
7070 wc ()->cart ->set_quantity ( $ existing_cart_id , $ request ['quantity ' ] + wc ()->cart ->cart_contents [ $ existing_cart_id ]['quantity ' ], true );
@@ -133,7 +133,7 @@ public function set_cart_item_quantity( $item_id, $quantity = 1 ) {
133133 __ ( '"%s" is already inside your cart. ' , 'woo-gutenberg-products-block ' ),
134134 $ product ->get_name ()
135135 ),
136- 403
136+ 400
137137 );
138138 }
139139
@@ -161,7 +161,7 @@ public function validate_add_to_cart( \WC_Product $product, $request ) {
161161 __ ( 'You cannot add "%s" to the cart because the product is out of stock. ' , 'woo-gutenberg-products-block ' ),
162162 $ product ->get_name ()
163163 ),
164- 403
164+ 400
165165 );
166166 }
167167
@@ -178,7 +178,7 @@ public function validate_add_to_cart( \WC_Product $product, $request ) {
178178 $ product ->get_name (),
179179 wc_format_stock_quantity_for_display ( $ qty_remaining , $ product )
180180 ),
181- 403
181+ 400
182182 );
183183 }
184184 }
@@ -270,7 +270,7 @@ public function validate_cart_item( $cart_item ) {
270270 __ ( 'There are too many "%s" in the cart. Only 1 can be purchased. ' , 'woo-gutenberg-products-block ' ),
271271 $ product ->get_name ()
272272 ),
273- 403
273+ 400
274274 );
275275 }
276276
@@ -282,7 +282,7 @@ public function validate_cart_item( $cart_item ) {
282282 __ ( '"%s" is out of stock and cannot be purchased. ' , 'woo-gutenberg-products-block ' ),
283283 $ product ->get_name ()
284284 ),
285- 403
285+ 400
286286 );
287287 }
288288
@@ -304,7 +304,7 @@ public function validate_cart_item( $cart_item ) {
304304 wc_format_stock_quantity_for_display ( $ qty_remaining , $ product ),
305305 $ product ->get_name ()
306306 ),
307- 403
307+ 400
308308 );
309309 }
310310 }
@@ -518,7 +518,7 @@ public function apply_coupon( $coupon_code ) {
518518 __ ( '"%s" is an invalid coupon code. ' , 'woo-gutenberg-products-block ' ),
519519 esc_html ( $ coupon_code )
520520 ),
521- 403
521+ 400
522522 );
523523 }
524524
@@ -530,15 +530,15 @@ public function apply_coupon( $coupon_code ) {
530530 __ ( 'Coupon code "%s" has already been applied. ' , 'woo-gutenberg-products-block ' ),
531531 esc_html ( $ coupon_code )
532532 ),
533- 403
533+ 400
534534 );
535535 }
536536
537537 if ( ! $ coupon ->is_valid () ) {
538538 throw new RouteException (
539539 'woocommerce_rest_cart_coupon_error ' ,
540540 wp_strip_all_tags ( $ coupon ->get_error_message () ),
541- 403
541+ 400
542542 );
543543 }
544544
@@ -561,7 +561,7 @@ function( $code ) {
561561 __ ( '"%s" has already been applied and cannot be used in conjunction with other coupons. ' , 'woo-gutenberg-products-block ' ),
562562 $ code
563563 ),
564- 403
564+ 400
565565 );
566566 }
567567 }
@@ -654,7 +654,7 @@ protected function get_product_for_cart( $request ) {
654654 throw new RouteException (
655655 'woocommerce_rest_cart_invalid_product ' ,
656656 __ ( 'This product cannot be added to the cart. ' , 'woo-gutenberg-products-block ' ),
657- 403
657+ 400
658658 );
659659 }
660660
@@ -696,7 +696,7 @@ protected function throw_default_product_exception( \WC_Product $product ) {
696696 __ ( '"%s" is not available for purchase. ' , 'woo-gutenberg-products-block ' ),
697697 $ product ->get_name ()
698698 ),
699- 403
699+ 400
700700 );
701701 }
702702
@@ -903,7 +903,7 @@ protected function get_variable_product_attributes( $product ) {
903903 throw new RouteException (
904904 'woocommerce_rest_cart_invalid_parent_product ' ,
905905 __ ( 'This product cannot be added to the cart. ' , 'woo-gutenberg-products-block ' ),
906- 403
906+ 400
907907 );
908908 }
909909
0 commit comments