• Resolved IT Hertz

    (@it-hertz)


    I browsed the hooks document and didn’t find this.
    What I’m looking to do is when the admin changes the order status from processing back to pending payment, the user’s account status and role (ultimate member) is changed, a custom email is sent to the user, and a custom notification email is sent to the designated recipients (rather than manually resending a repeat of the new order notification from the WC order actions dropdown), all with a single mouse click.

    I’ve added functions that change user’s account and send custom emails after the original checkout is completed, but I want to do all that when the user checks out again with the same order.
    Is there a hook I can use for this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @it-hertz,

    What I’m looking to do is when the admin changes the order status from processing back to pending payment, the user’s account status and role (ultimate member) is changed, a custom email is sent to the user, and a custom notification email is sent to the designated recipients (rather than manually resending a repeat of the new order notification from the WC order actions dropdown), all with a single mouse click.

    I’m a bit confused by this. Here, you mention you want this to happen when changing the order status from Processing back to Pending Payment, and in the next paragraph, you mention you want to do this when the user checks out again (wouldn’t checking out again naturally trigger all the checkout processes, as any checkout would do?). Can you clarify this?

    On the other hand, I must inform you that customization is limited in our support. However, a quick Google search may provide answers on integrating WooCommerce and Ultimate Member through Webhooks.

    Another option for development questions is to ask for insight on either the?WooCommerce Advanced Facebook group?or the?WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this will help you gain some further insight/information.

    Cheers!
    -OP

    Thread Starter IT Hertz

    (@it-hertz)

    On my client’s site, the user fills out a relatively complex CF7 form for their school, on which the user makes class and payment schedule selections. The students, max 5 per parent/user, are then sorted according to class levels, and the associated product and price values are sent to WC, among other things.
    With a single click of the Submit button, the following occurs:
    1. new user WP account is created
    2. account is populated (or updated) with WC user_meta
    3. WC order is generated
    4. various custom emails are sent to school personnel and the customer
    5. several other operations happen behind the scenes

    There’s a hold placed on each order and site access/login is blocked until the client approves the user’s application form. Once approved, the user is taken to a page upon login which explains how the user needs to pay (school has specific payment processes). There’s a button on that page, which takes the user directly to checkout when they’re ready to proceed, and in checkout they’re presented with payment options for completion of the order.

    Once that initial order goes thru, the user can’t check out again with the same order without the admin soft-cancelling the order via aforementioned status change. Without the admin changing status, the user would have to fill out the complex form again so the order could get compiled and go thru the whole process all over again. With the order status change, the user can just login again and be taken to checkout and done.

    The need for quick and easy repeating of the same order is in cases where a user’s role needs to be changed, based on other various things that occur on the site (I’ve set up many different roles/levels for users and school staff), or if a simple order edit is needed. The order number needs to be retained as well, for site operations and bookkeeping purposes.

    Basically, instead of the CF7 form submission firing events/functions to make WC (and UM) do things, I want the order status change in WC’s admin UI to fire functions that make UM and WP account handler do things.
    A major reason I want to do all of this by just changing the order status is to make things easy for subadmins, for whom I’ve created simple/limited UIs. The fewer controls they have to use, the better.

    I see there’s this for detecting the change:

    woocommerce_order_status_changed as in:
    do_action( 'woocommerce_order_status_changed', $this->get_id(), $status_transition['from'], $status_transition['to'], $this );

    Now to do the role changes and use different email templates to send out different notifications of the reorder.

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @it-hertz.

    Thank you so much for the detailed breakdown of your workflow. You’ve made a very interesting case use here and it’s great that you’re focusing on ways to simplify the process and the interface for your customers.

    I understand you’re looking to have the same order number for bookkeeping reasons. However, if you allow me to make a suggestion, I’d do this with an ACF field or similar that holds a unique registration number for them. This would simplify additional checkouts without the need to re-do the whole form; just invoice them, and that’s it.

    There are also plugins that can help you automate processes through Webhooks. I think checking these options would be advisable, as they can also make your workflow easier!

    Please keep in mind that, as mentioned before, this is a very complex scenario full of customizations that are beyond the limits of the free support scope. Please refer to my previous reply for options.

    PS: I see you’re a developer, would you be interested in joining our Automattic for Agencies program? You can learn more about it and its incentives here: https://woocommerce.com/for-agencies/.

    Cheers!
    -OP

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.