Title: An error occured
Last modified: June 7, 2026

---

# An error occured

 *  [hidegandras](https://wordpress.org/support/users/hidegandras/)
 * (@hidegandras)
 * [4 days, 22 hours ago](https://wordpress.org/support/topic/an-error-occured-9/)
 * Hello,
 * 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fan-error-occured-9%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [hidegandras](https://wordpress.org/support/users/hidegandras/)
 * (@hidegandras)
 * [4 days, 20 hours ago](https://wordpress.org/support/topic/an-error-occured-9/#post-18931031)
 * 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

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fan-error-occured-9%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/yith-woocommerce-gift-cards/assets/icon-256x256.gif?rev=
   3227932)
 * [YITH WooCommerce Gift Cards](https://wordpress.org/plugins/yith-woocommerce-gift-cards/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yith-woocommerce-gift-cards/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yith-woocommerce-gift-cards/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-woocommerce-gift-cards/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-woocommerce-gift-cards/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-woocommerce-gift-cards/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [hidegandras](https://wordpress.org/support/users/hidegandras/)
 * Last activity: [4 days, 20 hours ago](https://wordpress.org/support/topic/an-error-occured-9/#post-18931031)
 * Status: not resolved