Okay
  Public Ticket #3590875
Order approval for subaccounts and payment
Closed

Comments

  • Thomas Løvdahl started the conversation

    Hello!

    Regarding order approval of order placed by subaccount.

    Is it possible to automatically pay the order using the only payment method (invoice) when the order is approved by the main account?


    Thomas

  •  1,902
    WebWizards replied

    Hi Thomas,

    Thank you for purchasing our plugin,


    I understand you'd like that when the Approve button is clicked, that should also automatically pay for the order, to avoid an unnecessary step.

    We could achieve something similar to that, by replicating the effects of the invoice gateway.


    You could add the following PHP code snippet to the site to achieve it:

    add_action('b2bking_after_approve_order', function($order){
        $order->update_status( 'on-hold', esc_html__( 'Awaiting invoice payment.', 'b2bking' ) );
    }, 10, 1);
    

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

    It will set the order to the "on hold" status, similar to how the invoice gateway works.


    Please let me know if that can solve it for you,


    Kind regards,

    Stefan

  • Thomas Løvdahl replied

    Thank you, this worked perfectly :)

  •  1,902
    WebWizards replied

    Glad to hear that : ) If there's anything else I can help with, please let me know.

    Also, if you have a minute, I would really appreciate it if you considered leaving a quick rating for the plugin - it's a big help to us.