Creating a new extension attribute for an existing entity is usually a case of doing the following:
- Using setup scripts to set the attribute, column, or table for persistence
- Defining the extension attribute via <VendorName>/<ModuleName>/etc/extension_attributes.xml
- Adding an after and/or before plugin to the save, get, and getList methods of an entity repository
Moving forward, we are going to create extension attributes for the order entity, that is, customer_note and merchant_note.
We can imagine customer_note as an attribute that does not persist its value(s) in the sales_order table as order entity does, whereas merchant_note attribute does. This is why we created the sales_order.merchant_note column earlier ...