Conversation
supportHello, the plugin used to work fine, now it only gives an error message saying: An error occurred while adding the product to the cart. I checked the logs, console, nothing is shown to trace back to the issue. The page I need help with: [ log in to see the link]
I managed to make a hotfix, by replacing if ( isset( $_POST['add-to-cart'] ) ) {//phpcs:ignore WordPress.Security.NonceVerification $cart_item_data['ywgc_product_id'] = absint( $_POST['add-to-cart'] );//phpcs:ignore WordPress.Security.NonceVerification } elseif ( isset( $_REQUEST['ywgc_product_id'] ) ) {//phpcs:ignore WordPress.Security.NonceVerification $cart_item_data['ywgc_product_id'] = sanitize_text_field( wp_unslash( $_POST['ywgc-template-design'] ) );//phpcs:ignore WordPress.Security.NonceVerification } with if ( isset( $_POST['add-to-cart'] ) ) { $cart_item_data['ywgc_product_id'] = absint( $_POST['add-to-cart'] ); } elseif ( isset( $_REQUEST['ywgc_product_id'] ) ) { $cart_item_data['ywgc_product_id'] = absint( $_REQUEST['ywgc_product_id'] ); } elseif ( isset( $_REQUEST['product_id'] ) ) { $cart_item_data['ywgc_product_id'] = absint( $_REQUEST['product_id'] ); } in class-yith-cart-checkout.php
I managed to make a hotfix, by replacing if ( isset( $_POST['add-to-cart'] ) ) {//phpcs:ignore WordPress.Security.NonceVerification $cart_item_data['ywgc_product_id'] = absint( $_POST['add-to-cart'] );//phpcs:ignore WordPress.Security.NonceVerification } elseif ( isset( $_REQUEST['ywgc_product_id'] ) ) {//phpcs:ignore WordPress.Security.NonceVerification $cart_item_data['ywgc_product_id'] = sanitize_text_field( wp_unslash( $_POST['ywgc-template-design'] ) );//phpcs:ignore WordPress.Security.NonceVerification } with if ( isset( $_POST['add-to-cart'] ) ) { $cart_item_data['ywgc_product_id'] = absint( $_POST['add-to-cart'] ); } elseif ( isset( $_REQUEST['ywgc_product_id'] ) ) { $cart_item_data['ywgc_product_id'] = absint( $_REQUEST['ywgc_product_id'] ); } elseif ( isset( $_REQUEST['product_id'] ) ) { $cart_item_data['ywgc_product_id'] = absint( $_REQUEST['product_id'] ); } in class-yith-cart-checkout.php