Description
Preconditions and environment
Magento ver. 2.4.7-p6
The plugin Magento\InventoryConfigurableProduct\Plugin\Sales\GetSkuFromOrderItem assumes that the 'simple_sku' key is always present in the $orderItem->getProductOptions() array. In some cases (e.g. custom order creation, API orders, or legacy data), this key may be missing, resulting in a PHP warning.
Steps to reproduce
- Place or import an order for a configurable product where simple_sku is not set in the order item options.
- Trigger any process that calls GetSkuFromOrderItem::aroundExecute() (e.g. indexing, order view, or POS sync).
- Observe the PHP warning in logs or frontend.
Expected result
Magento should safely fall back to $orderItem->getSku() if simple_sku is not set.
Actual result
Error message "Undefined array key "simple_sku" in vendor/magento/module-inventory-configurable-product/Plugin/Sales/GetSkuFromOrderItem.php on line 36"
Additional information
Suggested Fix
Replace:
$sku = $orderItemOptions['simple_sku'];
With:
$sku = $orderItemOptions['simple_sku'] ?? $orderItem->getSku();
This ensures compatibility with orders that may not include the simple_sku key.
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
Assignees
Labels
Type
Projects
Status