private function getOrderItemVariables($item, $itemId)
    {
        $variables = [];

        if (!$item->isDummy()) {
            $prefix = "order.items.$itemId";
            $variables[$prefix . '.sku']        = $item->getSku();
            $variables[$prefix . '.product_id'] = $item->getProductId();
            $variables[$prefix . '.qty']        = $item->getQtyOrdered();
            $variables[$prefix . '.price']      = $item->getBasePrice();
            $variables[$prefix . '.row_total']  = $item->getRowTotal();
            $variables[$prefix . '.label']      = $item->getName();
            $variables[$prefix . '.salesrules'] = $item->getAppliedRuleIds();

            $product = $item->getProduct();
            if ($product) {
                $categoriesId = $product->getCategoryIds();
                if (count($categoriesId)) {
                    $variables[$prefix . '.category_ids'] = implode(",", $categoriesId);
                }
            }
        }

        return $variables;
    }
private function getOrderItemVariables($item, $itemId)
    {
        $variables = [];

        if (!$item->isDummy()) {
            $prefix = "order.items.$itemId";
            $variables[$prefix . '.sku']        = $item->getSku();
            $variables[$prefix . '.product_id'] = $item->getProductId();
            $variables[$prefix . '.qty']        = $item->getQtyOrdered();
            $variables[$prefix . '.price']      = $item->getBasePrice();
            $variables[$prefix . '.row_total']  = $item->getRowTotal();
            $variables[$prefix . '.label']      = $item->getName();
            $variables[$prefix . '.salesrules'] = $item->getAppliedRuleIds();

            $product = $item->getProduct();
            if ($product) {
                $categoriesId = $product->getCategoryIds();
                if (count($categoriesId)) {
                    $variables[$prefix . '.category_ids'] = implode(",", $categoriesId);
                }
            }
        }

        return $variables;
    }
private function getOrderItemVariables ( $ item , $ itemId ) { $ variables = [ ] ; if ( ! $ item -> isDummy ( ) ) { $ prefix = "order.items.$itemId" ; $ variables [ $ prefix . '.sku' ] = $ item -> getSku ( ) ; $ variables [ $ prefix . '.product_id' ] = $ item -> getProductId ( ) ; $ variables [ $ prefix . '.qty' ] = $ item -> getQtyOrdered ( ) ; $ variables [ $ prefix . '.price' ] = $ item -> getBasePrice ( ) ; $ variables [ $ prefix . '.row_total' ] = $ item -> getRowTotal ( ) ; $ variables [ $ prefix . '.label' ] = $ item -> getName ( ) ; $ variables [ $ prefix . '.salesrules' ] = $ item -> getAppliedRuleIds ( ) ; $ product = $ item -> getProduct ( ) ; if ( $ product ) { $ categoriesId = $ product -> getCategoryIds ( ) ; if ( count ( $ categoriesId ) ) { $ variables [ $ prefix . '.category_ids' ] = implode ( "," , $ categoriesId ) ; } } } return $ variables ; }
Retrieve tracking variables for an order item

@param \Magento\Sales\Model\Order\Item $item   The order item
@param int                             $itemId The order item id, dynamically generated.

@return array
Retrieve tracking variables for an order item