Description
Preconditions (*)
- 2.3.5-p1
- Magento 2.4-develop
Steps to reproduce (*)
- Go to Admin -> Stores -> Configuration -> Sales -> Sales Emails -> Invoice:
set Enable to Yes;
set Send Invoice Email Copy To to [email protected] - Create Order;
- Go to Admin -> Sales -> Orders and open created before order for edit;
- Click on the Invoice button;
- Uncheck "Email Copy of Invoice";
- Generate Invoice;
Expected result (*)
- Email should not be sent to anyone
Actual result (*)
- Email sent both to Customer and Copy To
The behavior changed from M1 to M2. Regardless if you check that checkbox or not, the email is sent to both the customer and the Copy To address. If you disable the sending of invoices in the Config section, there is no way to send invoice emails at all, because the "Send Email" button in the View Invoice screen does nothing, and the checkbox is not displayed in the New Invoice section.
Looking at the source code, I find this in vendor/magento/module-sales/Controller/Adminhtml/Order/Invoice/Save.php
, line 216:
if (!empty($data['send_email']) || $this->salesData->canSendNewInvoiceEmail()) {
$this->invoiceSender->send($invoice);
Looks good so far; if the config is "off", the checkbox would override the setting.
Unfortunately, the checkbox is not displayed at all when the config is "off".
Even if the checkbox would be visible, emails would not be sent, because in the file vendor/magento/module-sales/Model/Order/Email/Sender/InvoiceSender.php
at line 101, I find this:
public function send(Invoice $invoice, $forceSyncMode = false)
{
$invoice->setSendEmail($this->identityContainer->isEnabled());
This picks up the "off" value from the config, thus overriding any checkbox value again.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [*] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status