I have a code that is being passed in via the URL (akin to the Google source codes) that I want to add to the quote and order. I already have a function that triggers on the event controller_front_init_routers
that adds the data to the session to pull out later, and I've added the field to both the quote and order tables. However, I'm not able to add the data to the quote at that point since the quote doesn't exist in the event. Which event would be the best time to add my code to the quote?
Magento – When to add custom data to quote
magento-1.7quote
Best Answer
Depending on if you need to take cart contents into consideration my suggestion is to put your custom data into quote using either
sales_quote_collect_totals_before
orcheckout_quote_init
event.Then you can observe
sales_convert_quote_to_order
event and transfer your data from quote to order.