Integrate Product Details
It can be helpful to keep product details in a CMS like Builder, in place of or in complement to an e-commerce platform.
In this way, you can do things such as extend your product info with additional rich content, localize product info, use A/B testing, set up scheduling, and configure targeting.
Model definition
First, create a structured data model named product-detailswith some fields:
| name | type | notes |
|
| Product Name |
|
| Rich text for your product detailed description |
|
| List with subfields:
|
|
| A unique URL handle for this product; for example, |
|
| Reference to a collection, either to your backend via an e-commerce plugin or to another data model in Builder that represents your product collections |
You can create as many additional fields as you like for additional product info.
Example Code
Below is an example in pages/products/[product].jsx:
Create a file called pages/products/[product].tsx. This file handles the dynamic routing for individual product details.
Fetch productDetails in the resolver using fetchOneEntry() by providing the model, apiKey, and query with your handle.