Extending Order with custom fields #1058
-
Hello, would there be a way to extend the order model during checkout with custom fields. For example:
Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Everything in October is highly extendable. You can extend Mall's Order model and form according to the docs: You can also write migrations that add custom columns to the Order table or store the additional data in a custom table with a foreign key to the order. |
Beta Was this translation helpful? Give feedback.
-
Hello vesco88, could you provide an example how you extended the Orders? I'm also trying to add a order comment but something I'm missing... I'm not experiencing in plugin development. |
Beta Was this translation helpful? Give feedback.
Absolutely! Another option is to use the beforeCreate model event of the Order model and check the context. Is the current request a ajax request? Is it on your checkout URL? Is your custom data available via
post()
? If all is true, then set it on the model.