cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with additional_options array for quote_items

Problem with additional_options array for quote_items

Hi,

 

I have an observer on the checkout_cart_product_add_after event in which I add some information to the additional_options array.

Everything works fine except one case:

 

If I add an article to the cart without any additional information and afterwards add the same article with some additional information, the former quote item will be extended by the additional_options array and updated to quantity 2.

 

What I would like to achive is that I have two different quote items in the cart. One without additional options and one with. Both with quantitiy 1.

 

If I first add an item with additional information and afterwards add the same article without, everything works as expected.

 

Does anybody had the same problem before and know a solution?

 

Thanks

3 REPLIES 3

Re: Problem with additional_options array for quote_items

you can't add additional options after product added to cart, you need to add the options before product added to cart so cart knows the new quote item is different that the ones exist. you could use event 'catalog_product_type_prepare_%s_options'(%s is product type) or rewrite product type model.

Re: Problem with additional_options array for quote_items

OK, thanks.

 

Do you have a documentation of this event? I cannot find anything.

Re: Problem with additional_options array for quote_items

I found a different solution. I now use the catalog_product_load_after event and add my additional_options to the product.

After that I add the options to the quote_item.