I have a problem with a script in success page. I need to get the real product IDs of the order, now when i put an order with configurable products i get the id of the configurable product and not for the child which is in order.
i try to get the ids with
public function getItems(): array
{
return $this->_order ? $this->_order->getAllVisibleItems() : [];
}and
public function getProductId($order_item)
{
$variationUniqueId = $this->_helper->getVariationUniqueId();
$productId = $order_item->getProductId();
if (! $variationUniqueId && $order_item->getParentItem()) {
$productId = $order_item->getParentItem()->getProductId();
}
$product = $this->_product->load($productId);
return $product->getData($this->_helper->getUniqueId());
}
Use the below code
$this->_order->getAllItems()
Instead of the below code:
$this->_order->getAllVisibleItems()