0

Would be someone please be so kind and explained me structure of bundle products? I need to retrieve products in quote no matter if they belong to bundle or not, but if I get bundle product's item, then I see even more items than I actually have in quote. I mainly need to get product's quantity, sku, name, price, tax rate and tax amount.

I did not find suitable answer so please, do not mark question as duplicate if you do not have solution.

0

In the quote, a bundle product contains:

  1. one parent item with

    • qty: bundle qty
    • sku: depends on the SKU type of the bundle. If it is "fixed", this is the SKU of the bundle, if it is "dynamic" it is a combination of the bundle SKU and all selected simple product SKUs, separated by -
    • name: bundle name
    • price: calculated sum if the price type is "dynamic", bundle price if the price type is "fixed"
    • tax_percent: tax rate of the bundle, does not matter if price type is "dynamic"
    • tax_amount: see "price"
  2. a child item for each selected simple product

    • qty: selection qty (multiply by the bundle qty to get the total qty of this item)
    • sku: simple product sku
    • name: simple product name
    • price: simple product price if the bundle price type is "dynamic", 0 if the bundle price type is "fixed" (if you configured a price for the bundle selection instead of leaving the "use default" checkbox checked, this price is used and not the price of the simple product itself)
    • tax_percent: tax rate of the simple product, does not matter if bundle price type is "fixed"
    • tax_amount: see "price"

If you want to iterate over all rows of the cart, use $quote->getAllVisibleItems(), for bundle products this only returns the parent item.

(see also: How to get all items in cart currently?)

Your Answer

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