1

I use Magento 2 for my store and an email order confirmation is send automatically after an order even when the status payment is cancelled, invalid, review... I want to send an email confirmation only when a payment is completed or processing.

Could you please help me to change the parameter / the configuration to achieve this goal.

Thanks a lot

Majda

0

For this you can create observer on sales_order_place_after i will give you an just example create new file events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_place_after">
        <observer name="name of observer"
                  instance="Test\Email\Observer\SendEmail" />
    </event>
</config>

Then create Observer folder in your module

<?php

namespace Sivantos\HidePrice\Observer;

    use Magento\Framework\Event\Observer;

    class SendEmail implements \Magento\Framework\Event\ObserverInterface
    {

     public function execute(Observer $observer)
        {
         //code 
        }
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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