extractComponent( $checkout, 'Esun_Reward/js/view/payment/reward' ) ?? [ 'component' => 'Esun_Reward/js/view/payment/reward' ]; $reward['sortOrder'] = 21; $summary['esun-reward'] = $reward; // Amasty supplies an expandable details template. Use the theme's // always-open Magento template so product options display immediately. if (isset($summary['cart_items']['children']['details'])) { $summary['cart_items']['children']['details']['config']['template'] = 'Magento_Checkout/summary/item/details'; } $summary['totals']['sortOrder'] = 30; return $jsLayout; } private function extractComponent(array &$node, string $component): ?array { foreach (array_keys($node) as $key) { if (!isset($node[$key]) || !is_array($node[$key])) { continue; } if (($node[$key]['component'] ?? null) === $component) { $result = $node[$key]; unset($node[$key]); return $result; } $result = $this->extractComponent($node[$key], $component); if ($result !== null) { return $result; } } return null; } }