Sylius: Order confirmation email is sent at the wrong time

Created on 2 Oct 2016  路  3Comments  路  Source: Sylius/Sylius

I am looking at the order confirmation email right now, and it is sent after the order is created (not paid).

A lot of the Sylius code seems to revolve around payment being an after thought. Are you guys primary using it for stores that accept payment in cash?

I was going to adjust it to be after the payment is created, which also allows me to include the proper order details link as order token value hasn't been created until payment is done.

RFC

Most helpful comment

FYI, you can disable that sending, and add your own where you want easily:

winzou_state_machine:
    sylius_order:
        callbacks:
                sylius_order_confirmation_email:
                    disabled: true

    sylius_order_payment:
        callbacks:
            after:
                app_order_payment_confirmation_email:
                    to: ["paid"]
                    do: ["@app.email_manager", "sendPaymentConfirmationEmail"]
                    args: ["object"]

All 3 comments

IMO you should send the mail when the sylius_order_payment state machine (attribute payment_state on order) goes to paid :)

About the order confirmation email, it's not wrongly placed, it depends on your workflow.

You can easily change that, by customizing the state machine http://docs.sylius.org/en/latest/customization/state_machine.html.

We send it after order is placed, which is a sensible default.

Let me know if you have any further questions, otherwise please close the issue, thanks! :)

FYI, you can disable that sending, and add your own where you want easily:

winzou_state_machine:
    sylius_order:
        callbacks:
                sylius_order_confirmation_email:
                    disabled: true

    sylius_order_payment:
        callbacks:
            after:
                app_order_payment_confirmation_email:
                    to: ["paid"]
                    do: ["@app.email_manager", "sendPaymentConfirmationEmail"]
                    args: ["object"]
Was this page helpful?
0 / 5 - 0 ratings