2

When I get a order which includes a configurable product there seems to always be two order items for it. The first being the configurable product with price set to zero and the second being the simple product that the customer has selected with the correct price. The second one references the first one with the field parentItemId.

My question then is: when I export the order items to our internal order system, is it safe to always just ignore items which are of product type configurable and export the one of product type simple as I would with a regular simple product? Or is there anything else I need to keep in mind?

4

This is correct, the simple product is basically the product you want. However, price and quantity are stored in the configurable product.

So take the SKU of the simple product but qty and price of the configurable product and you should be fine.

  • 1
    I checked some sample data for this and it looks like the SKU on the configurable order item is actually the one from the simple product and it also has the right price/qty. That makes me think I could ignore all order items with simple type AND a parentItemId rather than what I originally wrote?I should probably test this a bit more but should the simple product order items be considered a "text row" in the order (meaning it is only there because of the text describing the selected attribute? – Patrik Lundgren Jan 17 '16 at 9:26
  • hm, interesting. Didn't know it had the same SKU! In that case you can indeed ignore all items with a parent_id if you're not using bundled products – Sander Mangel Jan 17 '16 at 9:46
  • 1
    What I dont understand is why the order item with type configurable is created at all. I mean the one with type simple references the configurable product as its parent anyway? – Patrik Lundgren Jan 17 '16 at 9:50
  • ah yeah that was a design choice by Magento. I get it they don't want to loose any data like it once being a configurable but in the API it has little value. In your case there is little use for it indeed – Sander Mangel Jan 17 '16 at 9:59
  • Yes I can see the purpose. Thanks for helping me sort this out, I should be able to set up the proper logic now I think! I cant very well ignore the bundled products scenario since I am sure we'll have some of those soon enough so I will go through that case as well. Speaking of these types of questions, is there any sort of documentation (for Magento 2) that would have explained how the Magento data model work so I wouldnt have to ask here? – Patrik Lundgren Jan 17 '16 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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