Menu Close
    Hire us Request quote Reading list Switch to dark mode

    Bundle product items in Magento 2

    Here, We are discussing how to get bundle product’s items and their product ids.

    Now here is code to get all the selection products of bundle product:


    It returns all the product’s items with item data and selection product’s data.

    Here, $productId , is a product id of bundle type product.

    $_productFactory is instance of Magento/Catalog/Model/ProductFactory

    $product is type of Magento/Catalog/Model/Product which holds the product data of product with id $productId.

    $selectionCollection is collection of products in bundle type product.

    $optionsCollection is collection of items used in bundle product.

    After Printing $optionArray and $productArray you will get data of bundle product’s items.

    Thank you.

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close