| @@ -44,11 +44,11 @@ | ||
| 44 | 44 | if ( ! Fns::verify_nonce() ) { |
| 45 | 45 | wp_send_json_error(); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $product_id = apply_filters( 'woocommerce_add_to_cart_product_id', ( isset( $_POST['product_id'] ) ? absint( $_POST['product_id'] ) : null ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 49 | - $quantity = empty( $_POST['quantity'] ) ? 1 : apply_filters( 'woocommerce_stock_amount', absint( $_POST['quantity'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 50 | - $variation_id = isset( $_POST['variation_id'] ) ? absint( $_POST['variation_id'] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 48 | + $product_id = apply_filters( 'woocommerce_add_to_cart_product_id', ( isset( $_POST['product_id'] ) ? absint( $_POST['product_id'] ) : null ) ); | |
| 49 | + $quantity = empty( $_POST['quantity'] ) ? 1 : apply_filters( 'woocommerce_stock_amount', absint( $_POST['quantity'] ) ); | |
| 50 | + $variation_id = isset( $_POST['variation_id'] ) ? absint( $_POST['variation_id'] ) : 0; | |
| 51 | 51 | $passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity ); |
| 52 | 52 | |
| 53 | 53 | if ( $passed_validation && WC()->cart->add_to_cart( $product_id, $quantity, $variation_id ) ) { |
| 54 | 54 | do_action( 'woocommerce_ajax_added_to_cart', $product_id ); |