Skip to content

Order confirmation emails are not sent after status change #28

@stefliekens

Description

@stefliekens

Since versions above 2.9.0 the order confirmation emails are no longer sent on status change to processing. Below the configured settings:
config-settings-ing

During some investigation I found probably the reason why this isn't working. In the Model\Processor class the $orderRepository->save() was removed and replace by a database transaction implementation to save the order and invoice together. But the Magento plugin Plugin/OrderStatePlugin which should trigger the email only listen on the after save action.

Here you can see the changes where I'm talking about.

I've created this patch/solution in my project. The after-save action is still triggered elsewhere during the result/redirect and/or webhook controllers, but I removed the old status check.

--- a/vendor/ingenico/m2-payment/Plugin/OrderStatePlugin.php     2021-10-18 06:54:05.000000000 +0200
+++ b/vendor/ingenico/m2-payment/Plugin/OrderStatePlugin.php     2022-02-02 20:48:35.000000000 +0100
@@ -52,8 +52,7 @@
             if ($this->cnf->getOrderConfirmationEmailMode($storeId) === OrderEmail::STATUS_ONCHANGE) {
                 $targetStatus = $this->cnf->getOrderStatusForConfirmationEmail($storeId);
                 if (!$result->getEmailSent()
-                    && $result->getData('status') == $targetStatus
-                    && $result->getOrigData('status') !== $targetStatus) {
+                    && $result->getData('status') == $targetStatus) {
                     $this->orderNotifier->notify($result);
                 }
             }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions