• Resolved arshhh12

    (@arshhh12)


    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

    (@subratamal)

    @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.