Simple Commerce Logo

Storing Orders on Customer

Sometimes you may run into a situation where you'd like to keep track of a customer's orders on their customer entry, instead of just attaching the customers from the order side.

On checkout, the ID of the order entry will be added to the customer's entry inside an orders array. If you wish to display this array in your Control Panel, create an Entries field, with the orders handle.

With {{ sc:customer:orders }} tag

In the future, the plan is to make the customer entry the source of truth for all order IDs but as this feature was introduced mid-version, a breaking change could not be introduced.

Therefore, a from="customer" parameter will need to be provided when using the tag, see below.

1{{ sc:customers:orders from="customer"}}
2 <!-- And all your order stuff -->
3{{ /sc:customers:orders }}

This feature was implemented after a feature request, see Discussion.

Need some help?

There's plenty of ways of getting help: either via opening a GitHub Issue, starting a conversation on the Statamic Discord or directly emailing me.