How to Add Additional Options in Magento 2

Magento 2 is a feature-rich platform that helps improve the shopping experience. However, many times it lacks in fulfilling the business requirements now that various types of business have its online presence. Luckily, the developers can offer customization to implement out of box functionalities.

As a part of such customization, you may want to add additional options in Magento 2 product page, cart page, etc. For example, you want to display a text box to allow customers to add comment box in the product page or to show installments selected by the customers on the cart page.

Also, it is important that you implement the customizations without affecting the core functionalities as it is not a good practice. The below method allows to add additional options in Magento 2 considering it.

Steps to Add Additional Options in Magento 2:

  1. Create events.xml at app\code\Vendor\Extension\etc\
  2. Create CheckoutCartAddObserver.php at app\code\Vendor\Extension\Observer\
  3. Create AddOptionToOrderObserver.php at app\code\Vendor\Extension\Observer\

That’s it. Adding options in Magento 2 was never this easy, isn’t it?

The below image shows how I implemented this method to show the number of installments:

Example of additional options added in the cart

For a similar solution in Magento, check here.

You may, however, ask your doubts in the Comments section below and I’d be happy to help 🙂

Thank You.

5
(based on 15 Reviews)
How to Add Additional Options in Magento 2Author Magento Badge

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

8 Comments

Leave a Reply

Your email address will not be published.