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

    Programmatically Add More Product With Custom Options To An Existing Quote In Magento 2

    Programmatically Add More Product With Custom Options To An Existing Quote In Magento 2:- In this blog we will see how we can add product with custom option to an existing quote.

    For Simple Type product you can check : Programmatically Add More Product To An Existing Quote In Magento 2

    To add product with custom options to an existing quote follow below steps:

    Step: 1

    Prepare Custom Options Data

    For Text type Options


    For Dropdown type Options


    For Date type Options


    Step 2:  Now create product custom option instance  array with upper prepared options data


    Step 3: Create product option interface instance and set custom option data to extension attributes


    Step 4: set all product info and custom option data to cart item and then save


    In this way we can more product with custom options to an existing quote in magento2. Hope it will be helpful for you. If you have any query then comment below.
    Thankyou!

     

    . . .

    Comments (3)

    Add Your Comment

  • Thomas
    How is it possible in multiple products? Because of the option_id different for each product.
    • Rani Priya
      Hi Thomas
      In case of multiple product you have to follow all the steps again. Or you can just create a method or function suppose addToCart() and then call this method in loop with different product options.
      Hope now you got your answer and in case if you still facing issue then comment below.
  • Bojjaiah
    It’s not working Can you give us complete example? or any help on below thread https://magento.stackexchange.com/questions/280891/create-order-programmatically-product-with-custom-options-magento2
  • 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