• Resolved bshort

    (@brendagshortyahoocom)


    I want to require B2B Users to create an invoice before paying. Once I examine the invoice and email them the invoice with a “Pay for this order” link, they need to be able to pay on the site with a credit card. However, it seems if I don’t enable Credit Cards so as to force the invoice, when they click the Pay link in the email, they still don’t have a credit card option, just another Invoice option. But if I do enable credit cards, they are not forced to create an invoice before paying.

Viewing 1 replies (of 1 total)
  • Plugin Author WebWizards

    (@webwizardsdev)

    Hi there,

    You could achieve this by following these steps:

    1. Enable all payment methods in B2BKing -> Groups for the respective group
    2. Add the following PHP code snippet to the site:
    function custom_payment_gateway_disable( $available_gateways ) {
        // Check if we are on the checkout page but not on the order-pay page
        if ( is_checkout() && !is_wc_endpoint_url( 'order-pay' ) ) {
            foreach ( $available_gateways as $gateway_key => $gateway ) {
                if ( $gateway_key != 'b2bking-invoice-gateway' ) {
                    unset( $available_gateways[ $gateway_key ] );
                }
            }
        }
    
        // Check if we are on the order-pay page
        if ( is_wc_endpoint_url( 'order-pay' ) ) {
            if ( isset( $available_gateways['b2bking-invoice-gateway'] ) ) {
                unset( $available_gateways['b2bking-invoice-gateway'] );
            }
        }
    
        return $available_gateways;
    }
    
    add_filter( 'woocommerce_available_payment_gateways', 'custom_payment_gateway_disable' );

    This code snippet can be either added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/

    Let me know if that works for you or if you need any other adjustments,

    The above assumes you’re using B2BKing’s invoice gateway.

Viewing 1 replies (of 1 total)
  • The topic ‘Invoice Payments’ is closed to new replies.