• Resolved

    (@educationguideonline)


    Hi dev,
    after adding this code on my functions.php , Checkout page becomes non-responsive. Can you please correct my code?

    add_filter(‘is_valid_payment_through_wallet’, ‘__return_false’);
    add_filter(‘woo_wallet_partial_payment_amount’, ‘woo_wallet_partial_payment_amount_callback’, 10, 2);

    function woo_wallet_partial_payment_amount_callback($amount, $order) {
    if (!is_null($order)) {
    $order_total = $order->get_total(‘edit’);
    if ($amount > $order_total) {
    $amount = ($order_total * 15) / 100;
    }
    } else if (sizeof(wc()->cart->get_cart()) > 0) {
    $cart_total = wc()->cart->get_total(‘edit’);
    if ($amount > $cart_total) {
    $amount = ($cart_total * 15) / 100;
    }
    }
    return $amount;
    }

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter

    (@educationguideonline)

    Thread Starter

    (@educationguideonline)

    Plugin Author Subrata Mal

    (@subratamal)

    Please use WooWallet plugin from our GitHub repo and use below updated code to theme function.php file.

    add_filter(‘is_valid_payment_through_wallet’, ‘__return_false’);
    add_filter(‘woo_wallet_partial_payment_amount’, ‘woo_wallet_partial_payment_amount_callback’, 100);

    function woo_wallet_partial_payment_amount_callback($amount) {
    if (sizeof(WC()->cart->get_cart()) > 0) {
    $totals = WC()->cart->get_totals();
    $cart_total = $totals[‘subtotal’] + $totals[‘shipping_total’] + $totals[‘subtotal_tax’] + $totals[‘shipping_tax’];
    if ($amount > $cart_total) {
    $amount = ($cart_total * 15) / 100;
    }
    }
    return $amount;
    }

    Thread Starter

    (@educationguideonline)

    Can you please give me the GitHub repo link?

    Plugin Author Subrata Mal

    (@subratamal)

    Thread Starter

    (@educationguideonline)

    Thanks got it.

    Thread Starter

    (@educationguideonline)

    Checkout issue has been gone.

    But calculation is not working.
    I tested with cart value ?1380. And wallet value ?500.

    But while checking out, it is showing ?500 debited from wallet, not ?1380*15%=?207.

    Plugin Author Subrata Mal

    (@subratamal)

    add_filter(‘is_valid_payment_through_wallet’, ‘__return_false’);
    add_filter(‘woo_wallet_partial_payment_amount’, ‘woo_wallet_partial_payment_amount_callback’, 100);
    
    function woo_wallet_partial_payment_amount_callback($amount) {
    if (sizeof(WC()->cart->get_cart()) > 0) {
    $totals = WC()->cart->get_totals();
    $cart_total = $totals[‘subtotal’] + $totals[‘shipping_total’] + $totals[‘subtotal_tax’] + $totals[‘shipping_tax’];
    $amount = ($cart_total * 15) / 100;
    }
    return $amount;
    }
    Thread Starter

    (@educationguideonline)

    Not worked…. ????

    Can you please provide your email address, I’ll send you the screenshot of functions.php and checkout page.

    It’s very urgent to me.

    Plugin Author Subrata Mal

    (@subratamal)

    Please reach out to us at [email protected]

    Thread Starter

    (@educationguideonline)

    I have mailed you from [email protected]

    Thread Starter

    (@educationguideonline)

    Thank you for your great support.
    My problem is now solved.

    Hello @subratamal,
    i have the same issue regarding partial payment can please help me to solve this issue

    Plugin Author Subrata Mal

    (@subratamal)

    @samshubbua,

    Please use update code to theme function.php file.

    add_filter('is_valid_payment_through_wallet', '__return_false');
    add_filter('woo_wallet_partial_payment_amount', 'woo_wallet_partial_payment_amount_callback', 100);
    
    function woo_wallet_partial_payment_amount_callback($amount) {
        if (sizeof(WC()->cart->get_cart()) > 0) {
            $totals = WC()->cart->get_totals();
            $cart_total = $totals['subtotal'] + $totals['shipping_total'] + $totals['subtotal_tax'] + $totals['shipping_tax'];
            $amount = ($cart_total * 15) / 100;
            if ($amount > woo_wallet()->wallet->get_wallet_balance(get_current_user_id(), 'edit')) {
                $amount = woo_wallet()->wallet->get_wallet_balance(get_current_user_id(), 'edit');
            }
        }
        return $amount;
    }
Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Partial payment issue’ is closed to new replies.