I need to dynamically add option choices to the cart items at the time a product is added to the cart. The choices presented to the shopper can change from product to product, so it is necessary that they are dynamic. However, the options will always be the same. For example "Option 1" might have values "a, b, c" for one product and "x, y, z" for another product. I do not need the options saved into the product, only the cart. The selections need to be displayed in the cart and in the order administration, receipt, etc.
I learned from this answer that I can use $cart->addProduct($product, $params)
in order to set custom options to the cart item.
I found that I can override the Cart controller at this blog post. I was able to dynamically add the product to the cart. However, I am stuck on how to add dynamic attribute values to the product. I tried setting 'options' and 'super_attribute' in $params
before calling $cart->addProduct($product, $params)
but it's not saving the values to the cart item.
Finally, some of the option choices would need to affect the product price. I am not sure how to account for this either.
Thanks in advance for any help!