I need to modify the price of a specific custom option set to a product when the user adds the product to the cart.
Business logic requires that prices be stored with 5 decimals of precision. Since this is not possible in Magento without significant core and database changes (see: Pricing precision beyond 4 digits ), I am exploring the use of a text field attribute (as this is only way to store values such as 0.02992) that will modify the price during add to cart (via observer on sales_quote_add_item
event).
Typical use of an observer like this would probably be similar to: https://stackoverflow.com/questions/5104482/programmatically-add-product-to-cart-with-price-change
This is great if I want to simply change the price of the simple product, but I require changing the price of one the custom options instead, and leaving the rest of the price calculation alone.
From what I can tell, $observer->getEvent()->getQuoteItem()
only includes the custom options' ids and values which leads me to believe that custom option prices are then later grabbed from another resource.
I feel like there is probably a more appropriate event to observe where the custom options' price is accessed, but am not finding much help.
How can I change the price of a single specific custom option through an observer when adding a product to the cart?