• Resolved jwbdv

    (@jwbdv)


    Hi ??

    i want to hide pay upon invoice, if the order is more than a maximun limit.

    How can this be achieved?

    thx a lot

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Krystian

    (@inpsydekrystian)

    Hello @jwbdv

    This can be achieved with a simple Code snippet that can be used for any payment gateway in PayPal Payments:

    add_filter('woocommerce_available_payment_gateways', function($gateways) {
        
        $maximumOrderTotal = 100; // Maximum allowed order total for displaying the gateway
    
        $shouldHideGatewayForHighTotal = function($orderTotal) use ($maximumOrderTotal) {
            return $orderTotal > $maximumOrderTotal;
        };
    
        if (WC()->cart && isset($gateways['ppcp-pay-upon-invoice-gatewa'])) {
            if ($shouldHideGatewayForHighTotal(WC()->cart->total)) {
                unset($gateways['ppcp-pay-upon-invoice-gatewa']);
            }
        }
    
        return $gateways;
    });

    Let us know if this meets your requirements.

    Kind regards,
    Krystian

    Plugin Support Krystian

    (@inpsydekrystian)

    Hello @jwbdv

    Since we have not received any further communication from you, we are assuming that your issue has been resolved.

    Therefore, we mark this thread as resolved. If you still have any questions or if a new problem arises, don’t hesitate to open a new thread or reply to this one. We are here to help at any time.

    Kind regards,
    Krystian

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘limit for pay upon invoice’ is closed to new replies.