Adding Promotion banners to Product Listing
1. Create a Metaobject Definition
This metaobject is used to configure promotion banner data.
- Go to Settings → Custom Data and add a metaobject definition.
- The definition name is “Promotion”. Make sure the type is also “promotion”.
-
Add the definition fields - Image, Text, Button Text, URL, Position:
-
Image (type: File)
The image of your banner.
-
-
Text (type: Single line text)
The text that should be displayed on the banner.
-
Button Text (type: Single line text)
The button text that should be displayed on the banner.
-
URL (type: URL)
The URL to which the banner should redirect customers when clicked.
-
Position (type: Integer)
Dictates after which product the promotion should be displayed in the grid.
- Click Save.
2. Create a Metafield Definition
This metafield is used to associate metaobjects with the collections to which promotions need to be shown.
- Go to Settings → Custom Data → Collections.
- Click “Add definition”.
-
Configure the definition as follows:
- Name: Promotions
- Namespace and key: convermax.promotions
- Type: Metaobject (List of entries); Reference: Promotion
- Click Save.
3. How to Use
- Go to Content → Metaobjects and click on the Promotion metaobject.
-
Add a promotion entry and populate the promotion data.
For example:
- Go to the collection in which you want to show the promotion and select entries in the “Promotions” metafield.
You can add multiple banners to a collection by creating multiple metaobject entries.