Title: Bug
Last modified: November 8, 2021

---

# Bug

 *  Resolved [arshhh12](https://wordpress.org/support/users/arshhh12/)
 * (@arshhh12)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-361/)
 * Hello !
    I have a website sell the digital voucher. On the website, I found a
   bug in the Terawallet plugin. The bug is that customers can checkout products
   and top up wallets at the same time. After the payment is successful, the customer’s
   wallet balance is increased by the amount of product checkout + top up wallet.
   And customers also get purchased digital products.
 * Please solve this problem.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Subrata Mal](https://wordpress.org/support/users/subratamal/)
 * (@subratamal)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/bug-361/#post-15070009)
 * [@arshhh12](https://wordpress.org/support/users/arshhh12/) Thanks for reporting
   this issue. We will fix this in our next update. For now, you can fix this by
   using bellow attached code in the theme function.php file.
 *     ```
       add_action('woocommerce_cart_loaded_from_session', 'woocommerce_cart_loaded_from_session_callback');
   
       if (!function_exists('woocommerce_cart_loaded_from_session_callback')) {
   
           /**
            * Remove wallet rechargeable product from the cart
            * if another product is added to the cart before.
            * @param WC_Cart $cart
            */
           function woocommerce_cart_loaded_from_session_callback($cart) {
               if (sizeof($cart->get_cart()) > 1) {
                   foreach ($cart->get_cart() as $cart_item_key => $cart_item) {
                       $product_id = $cart_item['variation_id'] ? $cart_item['variation_id'] : $cart_item['product_id'];
                       if ($product_id === get_wallet_rechargeable_product()->get_id()) {
                           WC()->cart->remove_cart_item($cart_item_key);
                       }
                   }
               }
           }
   
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Bug’ is closed to new replies.

 * ![](https://ps.w.org/woo-wallet/assets/icon-256x256.png?rev=3360666)
 * [Wallet for WooCommerce](https://wordpress.org/plugins/woo-wallet/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-wallet/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-wallet/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-wallet/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-wallet/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-wallet/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Subrata Mal](https://wordpress.org/support/users/subratamal/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/bug-361/#post-15070009)
 * Status: resolved