0

I'm trying to add custom field to first checkout step. It is University name for students, so it's not connected to shipping address or method.

I've added new column to sales_order table. But how can I save it? Should it be observer on some event, or plugin? I have no idea...

  • Shouldn't that be attached to the customer entity? Is it 1:1 relationship (each customer has one and only one university)? – benmarks Jun 16 '16 at 12:40
  • Hmm. Maybe you're right. But still I would like to add possibility to show this field in checkout, and connect to single order. – Bartłomiej Szubert Jun 16 '16 at 14:10
1

As a customer entity attribute, this field can be presented - and data can be captured - during checkout. If you want to convert it to a transactional record as part of the order, then that can be done as well, just as is done with other customer data at the time of order (remember, there is duplication of entity values relative to transactional moments, as this preserves historical info - think of a customer changing his or her name).

To find the implementation pattern, look at core markup & code which does this, e.g. customer_firstname. This will lead you to Checkout and Sales modules, specifically to configuration values, setup scripts, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.