How to Add Simple Products to Cart with Custom Options in Mageno 2.2+

After Magento 2.2 there was a major change to the way in which data is serialized within the store. This means that old methodologies of using serialize() no longer function. The following is how to add simple products to cart in Magento 2.2+ through the use of a controller.

If we wanted to add multiple custom options on the same product, “Shirt Color” and “Pocket Color” we would merely duplicate and update the additionalOptions array.

Hans-Eirik Hanifl

view all posts

Hans-Eirik Hanifl is a forward thinking e-commerce and marketing consultant. As an advocate for the free exchange of knowledge, he founded E-Commerce Gorilla as a place where like-minded individuals can ask questions and share their expertise on practical solutions in the area of e-commerce and marketing. He is the owner of TRM Marketing and an avid supporter of the open source community.

0 Comments Join the Conversation →


Leave a Reply

Stay in the loop!

E-Commerce Gorilla Avatar

Join the E-Commerce Gorilla e-mail newsletter. We provide monthly updates on new articles featuring all aspects of online sales and E-Commerce setup. We cover the do's and don'ts of effective online sales, along with great giveaways. As a newsletter subscriber you are automatically entered for any competitions and giveaways.* Join our community of engaged online marketing experts, great content, and great giveaways. You can't go wrong.