Skip to content

Shipment email not sent when submitted from Admin Order view despite being enabled in store configuration #39861

Open
@rns-nonaka-enagic

Description

@rns-nonaka-enagic

Preconditions and environment

  • Magento version
     2.4.7-p5
  • Multi-store setup with different configurations for shipment emails
  • Default store has shipment emails disabled
  • Secondary store has shipment emails enabled

Steps to reproduce

  1. Set up a multi-store configuration where the default store has shipment emails disabled
  2. Create an order in a secondary store that has shipment emails enabled
  3. Go to Admin > Sales > Orders
  4. Open the order from the secondary store
  5. Click on "Ship" button
  6. Fill in shipment details and check "Email Copy of Shipment"
  7. Submit the shipment

Expected result

The system should send a shipment confirmation email as it is enabled in the store configuration where the order was placed.

Actual result

No shipment confirmation email is sent because the system checks the default store configuration instead of the store configuration where the order was placed.

Additional information

Root cause analysis

In Save.php at line 170, the shipment email sending condition is checked using:

if (!empty($data['send_email']) && $this->salesData->canSendNewShipmentEmail())

The canSendNewShipmentEmail() method is called without passing the store ID parameter. This causes the system to check the configuration of the default store instead of the store where the order was placed.

The correct implementation should pass the order's store ID to this method:

if (!empty($data['send_email']) && $this->salesData->canSendNewShipmentEmail($shipment->getOrder()->getStoreId()))

This issue affects multi-store setups where different stores have different email configuration settings.

Release note

No response

Triage and priority

  • 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

Labels

Area: OrderComponent: EmailIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.7-p5Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

Status

Ready for Development

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions