0

I've created a store in Commerce 2. The store has 1 order type currently, which uses the default workflow (Draft->Completed/Cancelled). There is also 1 order item type only and all products belong to it. We currently have 1 payment gateway for people to pay by credit card (live).

I am now being asked to add payment by check as a possibility.

I added a new "Check" payment gateway using the "Manual" plugin and things looked good, but when choosing it, the order gets the "Completed" status. (Payment is "Pending" as expected.) This is rather counter-intuitive for the staff. Another status (even staying at "Draft") would be preferable.

I though to switch the order type to the "Default, with Validation" workflow (Draft->Validation->Completed/Cancelled). This seems like to right solution for people paying by check... But the vast majority of people pay by credit card and their order should be immediately be completed without any validation.

I also read up on creating a 2nd order type with the "Default, with Validation" workflow, but that seems to entail having a completely separate order item type (and therefore separate products!) so it seems like the wrong way to go.

  • Is the solution to create a custom workflow that encompasses both possibilities? (With a way to transition from "Draft" to "Completed" for credit card payments and from "Draft" to "Validation" for check payments.)
  • Or is it better to use the "Default, with Validation" workflow and have a subscriber wait for when an order is set to the "Validation" state, verify the payment gateway and advance the credit card orders to "Completed" automatically? (seems a bit hack-y)
  • Is there another solution to this (I assume) common problem that I missed?

1 Answer 1

0

Seems like I was wrong about the 2nd order type. Here's what I ended up doing:

I created a 2nd Order Type with the "Default, with Validation" workflow and a 2nd Order Item Type pointing to the new Order Type.

Then I used the "hook_commerce_order_presave" hook to change the order type from the default first Order Type to the other at the "review" step of the checkout.

Still, to me, this seems like a common enough occurrence (checks & credit cards accepted in one store) that there should be a no-code solution. If someone know it, please share!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.