Updating custom field values on order creation

Using ACF, you can define custom fields for orders, that get automatically updated on order creation.

This is useful when a customer provides values for an order, that you need to handle in a structured way after the fact, like including the information in your order notifications, invoices or in the customer's order overview.

Examples include purchase order references, special delivery instructions, "how did you hear about us" dropdowns or any other information that doesn't fit neatly into the default "order note" field, that is available for a Shopify order.

Collecting these types of values from the customer in the cart is supported by Shopify via the concept of "cart attributes", which is documented in this help article. However, ACF takes this concept a step further and can pull the provided information from the order's attributes into separate custom fields defined by you, so you can handle them more elegantly like showing the provided values on a customer's order overview.

Due to the fact that Shopify handles cart attributes as pure text, the integration is currently not possible for files

How to link cart attributes with ACF fields

For every field, you'd like to have updated from the order via a cart attribute value, you need to enable this checkbox in the field definition:

Once saved, ACF will listen to new orders being created and look at the incoming order's list of provided cart attributes and compare these with any defined fields with the checkbox "Set value automatically when order is placed" checked.

Example

Your have an order custom field defined like this:

and this field definition is part of your cart's form:

<input name="attributes[Purchase Order Reference]" type="text" ....>

Then ACF will match the cart attribute named "Purchase Order Reference" with your defined fields and update the custom field's value with whatever value was provided via the order.

Matching a cart attribute with a custom field is done by looking at the "name" provided in your cart attribute fields and compare it to your custom fields' label. In case you're wondering, this is done without looking at upper-/lowercases, so feel free to mix as you please.

You can also use the field's name as the cart attribute name, if this suits you better, so this approach also links the attribute with the custom field:

<input name="attributes[purchase_order_reference]" type="text" ....>

You can use the Shopify UI Elements Generator to define your cart attributes

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us