Disable sending order email programmaticalyHow to send set password email?Order confirmation email sent multiple time - same order confirmation sent to all - unable to stop sendingOrder emails not sending to Sales Representative (store email address)Magento 1.9.2 not sending new order confirmation emailsEmail sending issue in Magento CE 1.9.2.1is we need to pay and return to site successfully to get paypal order confirmation emailMagento 2 - Place an order without sending emailMagento 2: Split order for every ItemSend emails after the order was placed - Magento 1.9Sending order confirmation email template in Magento 2
What does the homotopy coherent nerve do to spaces of enriched functors?
What is this object?
In Pandemic, why take the extra step of eradicating a disease after you've cured it?
How can I list the different hex characters between two files?
What do you call the action of "describing events as they happen" like sports anchors do?
Professor Roman loves to teach unorthodox Chemistry
Grandpa has another non math question
Why does there seem to be an extreme lack of public trashcans in Taiwan?
How can powerful telekinesis avoid violating Newton's 3rd Law?
ASCII Meme Arrow Generator
What is the STRONGEST end-of-line knot to use if you want to use a steel-thimble at the end, so that you've got a steel-eyelet at the end of the line?
Why do (or did, until very recently) aircraft transponders wait to be interrogated before broadcasting beacon signals?
Is Jesus the last Prophet?
How do I type a hyphen in iOS 12?
Parsing text written the millitext font
Make Gimbap cutter
How much web presence should I have?
Why is it bad to use your whole foot in rock climbing
What is this Amiga 2000 mod?
What does "lit." mean in boiling point or melting point specification?
What's the difference between DHCP and NAT? Are they mutually exclusive?
That's not my X, its Y is too Z
Am I allowed to determine tenets of my contract as a warlock?
Realistic, logical way for men with medieval-era weaponry to compete with much larger and physically stronger foes
Disable sending order email programmaticaly
How to send set password email?Order confirmation email sent multiple time - same order confirmation sent to all - unable to stop sendingOrder emails not sending to Sales Representative (store email address)Magento 1.9.2 not sending new order confirmation emailsEmail sending issue in Magento CE 1.9.2.1is we need to pay and return to site successfully to get paypal order confirmation emailMagento 2 - Place an order without sending emailMagento 2: Split order for every ItemSend emails after the order was placed - Magento 1.9Sending order confirmation email template in Magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
For some reason, I'm splitting my order in two part (the first is handle by some organization and the other will me handle by the magento owner).
I'm creating programmatically the order, and for one of the part, I need to stop the mail of the order to be sended.
Example :
In quote : watch, Tv, video game.
Splitting in two parts :
- watch, tv
- video games
Send email for the watch and tvs
Not send mail for video game.
How can I do this ?
EDIT : i'm splitting my code by doing a foreach on the quote item. If the item is in a category, I create a array with those items.
Then I'm creating my order like this : https://www.rakeshjesadiya.com/how-to-create-order-programmatically-in-magento-2/
And i'm calling the method twice, one for the first part, the other for the second.
I've notice that the email is not sended for the second part if I have placed those 2 orders parts. That's ok I guess, but if the first part is not placed, the second part will send a mail.
magento2 orders email
add a comment |
For some reason, I'm splitting my order in two part (the first is handle by some organization and the other will me handle by the magento owner).
I'm creating programmatically the order, and for one of the part, I need to stop the mail of the order to be sended.
Example :
In quote : watch, Tv, video game.
Splitting in two parts :
- watch, tv
- video games
Send email for the watch and tvs
Not send mail for video game.
How can I do this ?
EDIT : i'm splitting my code by doing a foreach on the quote item. If the item is in a category, I create a array with those items.
Then I'm creating my order like this : https://www.rakeshjesadiya.com/how-to-create-order-programmatically-in-magento-2/
And i'm calling the method twice, one for the first part, the other for the second.
I've notice that the email is not sended for the second part if I have placed those 2 orders parts. That's ok I guess, but if the first part is not placed, the second part will send a mail.
magento2 orders email
Are you able to split the order base on this logic
– Amit Bera♦
Jun 5 at 9:37
share the code which you used for split the order.
– Dhiren Vasoya
Jun 5 at 9:44
I've added an explanation and a link to my methods (my code is exactly the same)
– Morgan Tartreau
Jun 5 at 9:55
add a comment |
For some reason, I'm splitting my order in two part (the first is handle by some organization and the other will me handle by the magento owner).
I'm creating programmatically the order, and for one of the part, I need to stop the mail of the order to be sended.
Example :
In quote : watch, Tv, video game.
Splitting in two parts :
- watch, tv
- video games
Send email for the watch and tvs
Not send mail for video game.
How can I do this ?
EDIT : i'm splitting my code by doing a foreach on the quote item. If the item is in a category, I create a array with those items.
Then I'm creating my order like this : https://www.rakeshjesadiya.com/how-to-create-order-programmatically-in-magento-2/
And i'm calling the method twice, one for the first part, the other for the second.
I've notice that the email is not sended for the second part if I have placed those 2 orders parts. That's ok I guess, but if the first part is not placed, the second part will send a mail.
magento2 orders email
For some reason, I'm splitting my order in two part (the first is handle by some organization and the other will me handle by the magento owner).
I'm creating programmatically the order, and for one of the part, I need to stop the mail of the order to be sended.
Example :
In quote : watch, Tv, video game.
Splitting in two parts :
- watch, tv
- video games
Send email for the watch and tvs
Not send mail for video game.
How can I do this ?
EDIT : i'm splitting my code by doing a foreach on the quote item. If the item is in a category, I create a array with those items.
Then I'm creating my order like this : https://www.rakeshjesadiya.com/how-to-create-order-programmatically-in-magento-2/
And i'm calling the method twice, one for the first part, the other for the second.
I've notice that the email is not sended for the second part if I have placed those 2 orders parts. That's ok I guess, but if the first part is not placed, the second part will send a mail.
magento2 orders email
magento2 orders email
edited Jun 5 at 9:55
Morgan Tartreau
asked Jun 5 at 9:05
Morgan TartreauMorgan Tartreau
483212
483212
Are you able to split the order base on this logic
– Amit Bera♦
Jun 5 at 9:37
share the code which you used for split the order.
– Dhiren Vasoya
Jun 5 at 9:44
I've added an explanation and a link to my methods (my code is exactly the same)
– Morgan Tartreau
Jun 5 at 9:55
add a comment |
Are you able to split the order base on this logic
– Amit Bera♦
Jun 5 at 9:37
share the code which you used for split the order.
– Dhiren Vasoya
Jun 5 at 9:44
I've added an explanation and a link to my methods (my code is exactly the same)
– Morgan Tartreau
Jun 5 at 9:55
Are you able to split the order base on this logic
– Amit Bera♦
Jun 5 at 9:37
Are you able to split the order base on this logic
– Amit Bera♦
Jun 5 at 9:37
share the code which you used for split the order.
– Dhiren Vasoya
Jun 5 at 9:44
share the code which you used for split the order.
– Dhiren Vasoya
Jun 5 at 9:44
I've added an explanation and a link to my methods (my code is exactly the same)
– Morgan Tartreau
Jun 5 at 9:55
I've added an explanation and a link to my methods (my code is exactly the same)
– Morgan Tartreau
Jun 5 at 9:55
add a comment |
1 Answer
1
active
oldest
votes
Magento has an event to send email for order defined in following file.
vendor/magento/module-quote/etc/frontend/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_model_service_quote_submit_success">
<observer name="sendEmail" instance="MagentoQuoteObserverSubmitObserver" />
</event>
</config>
If you will look into the SubmitObserver File, you will find below code.
public function execute(MagentoFrameworkEventObserver $observer)
/** @var MagentoQuoteModelQuote $quote */
$quote = $observer->getEvent()->getQuote();
/** @var MagentoSalesModelOrder $order */
$order = $observer->getEvent()->getOrder();
/**
* a flag to set that there will be redirect to third party after confirmation
*/
$redirectUrl = $quote->getPayment()->getOrderPlaceRedirectUrl();
if (!$redirectUrl && $order->getCanSendNewEmailFlag())
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
So to stop sending email, you can create a plugin in your module as follows.
app/code/vendor/module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteObserverSubmitObserver">
<plugin name="custom_order_stop_email" type="VendorModulePluginSubmitObserver" />
</type>
</config>
Vendor/Module/Plugin/SubmitObserver.php
<?php
namespace VendorModulePlugin;
class SubmitObserver
public function beforeExecute($subject, $observer)
$order = $observer->getEvent()->getOrder();
if ('Your product condition')
$order->setCanSendNewEmailFlag(false);
return [$observer];
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f277330%2fdisable-sending-order-email-programmaticaly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Magento has an event to send email for order defined in following file.
vendor/magento/module-quote/etc/frontend/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_model_service_quote_submit_success">
<observer name="sendEmail" instance="MagentoQuoteObserverSubmitObserver" />
</event>
</config>
If you will look into the SubmitObserver File, you will find below code.
public function execute(MagentoFrameworkEventObserver $observer)
/** @var MagentoQuoteModelQuote $quote */
$quote = $observer->getEvent()->getQuote();
/** @var MagentoSalesModelOrder $order */
$order = $observer->getEvent()->getOrder();
/**
* a flag to set that there will be redirect to third party after confirmation
*/
$redirectUrl = $quote->getPayment()->getOrderPlaceRedirectUrl();
if (!$redirectUrl && $order->getCanSendNewEmailFlag())
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
So to stop sending email, you can create a plugin in your module as follows.
app/code/vendor/module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteObserverSubmitObserver">
<plugin name="custom_order_stop_email" type="VendorModulePluginSubmitObserver" />
</type>
</config>
Vendor/Module/Plugin/SubmitObserver.php
<?php
namespace VendorModulePlugin;
class SubmitObserver
public function beforeExecute($subject, $observer)
$order = $observer->getEvent()->getOrder();
if ('Your product condition')
$order->setCanSendNewEmailFlag(false);
return [$observer];
add a comment |
Magento has an event to send email for order defined in following file.
vendor/magento/module-quote/etc/frontend/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_model_service_quote_submit_success">
<observer name="sendEmail" instance="MagentoQuoteObserverSubmitObserver" />
</event>
</config>
If you will look into the SubmitObserver File, you will find below code.
public function execute(MagentoFrameworkEventObserver $observer)
/** @var MagentoQuoteModelQuote $quote */
$quote = $observer->getEvent()->getQuote();
/** @var MagentoSalesModelOrder $order */
$order = $observer->getEvent()->getOrder();
/**
* a flag to set that there will be redirect to third party after confirmation
*/
$redirectUrl = $quote->getPayment()->getOrderPlaceRedirectUrl();
if (!$redirectUrl && $order->getCanSendNewEmailFlag())
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
So to stop sending email, you can create a plugin in your module as follows.
app/code/vendor/module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteObserverSubmitObserver">
<plugin name="custom_order_stop_email" type="VendorModulePluginSubmitObserver" />
</type>
</config>
Vendor/Module/Plugin/SubmitObserver.php
<?php
namespace VendorModulePlugin;
class SubmitObserver
public function beforeExecute($subject, $observer)
$order = $observer->getEvent()->getOrder();
if ('Your product condition')
$order->setCanSendNewEmailFlag(false);
return [$observer];
add a comment |
Magento has an event to send email for order defined in following file.
vendor/magento/module-quote/etc/frontend/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_model_service_quote_submit_success">
<observer name="sendEmail" instance="MagentoQuoteObserverSubmitObserver" />
</event>
</config>
If you will look into the SubmitObserver File, you will find below code.
public function execute(MagentoFrameworkEventObserver $observer)
/** @var MagentoQuoteModelQuote $quote */
$quote = $observer->getEvent()->getQuote();
/** @var MagentoSalesModelOrder $order */
$order = $observer->getEvent()->getOrder();
/**
* a flag to set that there will be redirect to third party after confirmation
*/
$redirectUrl = $quote->getPayment()->getOrderPlaceRedirectUrl();
if (!$redirectUrl && $order->getCanSendNewEmailFlag())
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
So to stop sending email, you can create a plugin in your module as follows.
app/code/vendor/module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteObserverSubmitObserver">
<plugin name="custom_order_stop_email" type="VendorModulePluginSubmitObserver" />
</type>
</config>
Vendor/Module/Plugin/SubmitObserver.php
<?php
namespace VendorModulePlugin;
class SubmitObserver
public function beforeExecute($subject, $observer)
$order = $observer->getEvent()->getOrder();
if ('Your product condition')
$order->setCanSendNewEmailFlag(false);
return [$observer];
Magento has an event to send email for order defined in following file.
vendor/magento/module-quote/etc/frontend/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_model_service_quote_submit_success">
<observer name="sendEmail" instance="MagentoQuoteObserverSubmitObserver" />
</event>
</config>
If you will look into the SubmitObserver File, you will find below code.
public function execute(MagentoFrameworkEventObserver $observer)
/** @var MagentoQuoteModelQuote $quote */
$quote = $observer->getEvent()->getQuote();
/** @var MagentoSalesModelOrder $order */
$order = $observer->getEvent()->getOrder();
/**
* a flag to set that there will be redirect to third party after confirmation
*/
$redirectUrl = $quote->getPayment()->getOrderPlaceRedirectUrl();
if (!$redirectUrl && $order->getCanSendNewEmailFlag())
try
$this->orderSender->send($order);
catch (Exception $e)
$this->logger->critical($e);
So to stop sending email, you can create a plugin in your module as follows.
app/code/vendor/module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteObserverSubmitObserver">
<plugin name="custom_order_stop_email" type="VendorModulePluginSubmitObserver" />
</type>
</config>
Vendor/Module/Plugin/SubmitObserver.php
<?php
namespace VendorModulePlugin;
class SubmitObserver
public function beforeExecute($subject, $observer)
$order = $observer->getEvent()->getOrder();
if ('Your product condition')
$order->setCanSendNewEmailFlag(false);
return [$observer];
answered Jun 5 at 9:41
Yash ShahYash Shah
1,106210
1,106210
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f277330%2fdisable-sending-order-email-programmaticaly%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you able to split the order base on this logic
– Amit Bera♦
Jun 5 at 9:37
share the code which you used for split the order.
– Dhiren Vasoya
Jun 5 at 9:44
I've added an explanation and a link to my methods (my code is exactly the same)
– Morgan Tartreau
Jun 5 at 9:55