Let’s face it, when you’re running an e-commerce platform like Magento 2, you expect core functionality to, well, work. Recently, a nasty little bug was introduced in Magento 2.4.7 that breaks the fundamental process of updating an order’s status and saving a corresponding administrative note.
If you’ve upgraded to 2.4.7 and noticed your order notes and confirmation emails listing the wrong status after an update, you’re not alone. We’ve tracked down the issue and implemented a fix by overriding a core controller.
The Problem: Status Stuck on ‘Pending’
The issue manifests when an admin attempts to change an order status that is not PROCESSING or FRAUD.
For instance, when viewing an order currently in Pending status and changing it to Accepted via the admin notes section, you might see the following behavior:
- The status is selected as
Acceptedand the form is submitted via an AJAX request. - The AJAX post data correctly includes the new status:
history%5Bstatus%5D=accepted. - The request succeeds, but the resulting order history note is saved with the old status (
Pending). - The customer email notification related to this status change also incorrectly lists the status as
Pendinginstead ofAccepted.
In short: the order object itself is updated, but the note creation process gets confused and uses the old status, making your audit trail and customer communications inaccurate.
Tracking Down the Issue (The Root Cause)
The part of the Magento codebase responsible for handling order status history and notes is the AddComment controller, which processes the AJAX request you see when saving a note.
The key lies within the core controller:
Magento\Sales\Controller\Adminhtml\Order\AddComment
Specifically, the method that determines which status to save with the note, getOrderStatus(), was modified in Magento 2.4.7.
In the buggy 2.4.7 version, the logic inside getOrderStatus() was changed to be overly restrictive. It now only updates the order status when the current status is either PROCESSING or FRAUD. If the current status is anything else (like Pending), the method defensively returns the current status, completely ignoring the new status selected by the admin in the form!
This change essentially broke status updates for all orders that start in a status other than PROCESSING or FRAUD, reverting the status used for the note creation back to the original value.
The Fix: Overriding the Core Controller
Since the bug is in a core controller method, the most robust solution is to create a custom module override (preference) that restores the pre-2.4.7 logic: always use the new status from the form when it’s provided and different.
We’ll use a module structure like SeismicPixels\CoreOverrides.
1. The Controller Override
We create a new controller that extends the core one and override the getOrderStatus method. Note that this is part of a previously created module.
app/code/SeismicPixels/CoreOverrides/Controller/Adminhtml/Order/AddComment.php
<?php
/**
* Override for Magento\Sales\Controller\Adminhtml\Order\AddComment
*
* Fixes Magento 2.4.7 bug where order status from form is not used when current status
* is not PROCESSING or FRAUD. This bug was introduced in Magento 2.4.7 and causes
* notes to be saved with the wrong status (e.g., 'Pending' instead of 'Accepted').
*
* This worked correctly in Magento 2.4.6 and earlier versions.
*/
declare(strict_types=1);
namespace SeismicPixels\CoreOverrides\Controller\Adminhtml\Order;
class AddComment extends \Magento\Sales\Controller\Adminhtml\Order\AddComment
{
/**
* Get order status
*
* @param \Magento\Sales\Model\Order $order
* @param array $data
* @return string
*/
protected function getOrderStatus(\Magento\Sales\Model\Order $order, $data): string
{
$historyStatus = isset($data['history_status']) ? $data['history_status'] : false;
// Fixed: Always use the historyStatus (from form) when provided and different,
// instead of only for PROCESSING or FRAUD orders.
if ($historyStatus && $historyStatus !== $order->getStatus()) {
return $historyStatus;
}
return $order->getStatus();
}
}
2. Registering the Preference
Next, we tell Magento to use our custom controller instead of the core one by registering a preference in our module’s di.xml file.
app/code/SeismicPixels/CoreOverrides/etc/adminhtml/di.xml (or just etc/di.xml if your preference is site-wide)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference
for="Magento\Sales\Controller\Adminhtml\Order\AddComment"
type="SeismicPixels\CoreOverrides\Controller\Adminhtml\Order\AddComment" />
</config>
Next Steps
Once the files are deployed, the final step is to clear your cache to make sure Magento registers the new preference:
Bash
php bin/magento cache:clean
After clearing the cache, changing an order from Pending to Accepted will correctly save the note and send the email using the Accepted status.
This fix is backward-compatible and restores the correct behavior from earlier Magento versions.
Conclusion and Official Bug Report
This is a known and frustrating issue in Magento 2.4.7. For more technical details and to follow the official progress on a core patch, you can refer to the primary source:
- GitHub Issue #38723 (Official Magento repository): https://github.com/magento/magento2/issues/38723
Cheers!

Leave a Reply