1

enter image description here

Hello.

configurable product generates 2 lines : one with the actual price and the other one with $0 price. this happens 1-2 out of 100 orders.

Can anyone help me with this duplicate issue? Thank you in advance.

2 Answers 2

4

By default this shouldn't happen.
It's true that when you add one configurable product to the cart there are actually 2 lines in there. One for the simple product and one for the configurable itself. These 2 lines are carried to the order and then invoice, shipping and credit memo, but only one of them should be visible.
Here is how the core code for the invoice items pdf looks like:

        foreach ($invoice->getAllItems() as $item){
            if ($item->getOrderItem()->getParentItem()) {
                continue;
            }
            /* Draw item */
            $this->_drawItem($item, $page, $order);
            $page = end($pdf->pages);
        } 

The if statement prevents the row with the price 0 from being shown.
Your problem might appear when the if condition returns false or if you have a custom module installed that might affect the order or the invoice process.
If you don't have a specific scenario to reproduce this every time, I'm afraid no one may be able to answer this.
Take this. It might help

3
  • Thank you for your answer. I'll try and see if any module is causing the problem.
    – user9814
    Commented Dec 12, 2014 at 18:36
  • Hi Marius, I am facing the same issue at Magento 2 without any thrid party extension. Is it something which can be managed from the backend? Commented May 23, 2016 at 5:18
  • @AkshayJindal. Sorry I haven't looked in that part of Magneto 2 yet
    – Marius
    Commented May 23, 2016 at 6:04
0

The best way:

$products = $request->getAllItems();

foreach($products as $product){

     if ($product->getParentItem()) {
                continue;
     }

   //more code here!

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.