관련 개인/그룹
정당

지역
카테고리
0521_5월19일20일_직능본부_보도자료_정책제안식_및_지지선언문_전달식_성황리개최v2.pdf공유
공유하기
닫기페이스북트위터카카오톡URL 복사
use Drupal\commerce_order\Entity\Order; /** * Implements hook_preprocess_HOOK() for commerce_checkout_order_summary. */ function your_theme_preprocess_commerce_checkout_order_summary(&$variables) { $order = $variables['order_entity']; // 주문 엔터티 $product_ids = []; if ($order instanceof Order) { foreach ($order->getItems() as $order_item) { $purchased_entity = $order_item->getPurchasedEntity(); if ($purchased_entity && $purchased_entity->getProduct()) { $product = $purchased_entity->getProduct(); $product_ids[] = $product->id(); } } } // Twig 템플릿에서 사용할 변수 추가 $variables['product_ids'] = $product_ids; }
댓글 달기