- Published on
Sitecore Tutorial – Sitecore Ordercloud Extended Properties Workaround
- Authors
- Name
- Michal Strzalkowski
- @michalmadethis
One of the strengths of Sitecore Ordercloud as a product is the flexibility to very easily append the default ‘commerce’ data model properties (e.g. price, description) with custom properties that more closely match your domain model (e.g. lipstick shade).
Ordercloud facilitates this through allowing you to stick all of this data into a JSON blob and storing them against the product’s Extended Properties (XP) field. (see https://ordercloud.io/knowledge-base/extended-properties)
The big caveat which must be accomodated is a 8000 byte limit on each product XP object, so determining which fields make the cut will be primarily determined by whether those fields should be searchable from Ordercloud APIs.
For any other data we want to store against the product, the ordercloud ingestion process will require splitting the data and mapping the reference.
Retrieving this ‘overfill’ data and stitching up the complete Product when the front-end requests it becomes the next consideration to tackle. Performing this data transformation in front-end javascript is possible, but not advisable due to maintenance and performance impact.
This architecture necessitates the use of a middleware layer, preferable using the Backend For Frontend (BFF) architecture pattern to produce view coupled viewmodels in middleware microservices. (see https://learn.microsoft.com/en-us/azure/architecture/patterns/backends-for-frontends)
This approach neatly allows us to make both API calls from the BFF layer, clean up the data to match the desired front-end payload and then cache the response aggressively to save on multiple requests to source systems.
Limitations
- This approach prevents ‘overflow data’ from being indexed by Ordercloud
- This approach necessitates middleware to generate a ‘complete’ Product object.