To ensure a product appears on your site, complete the steps in this article.
If you try to publish this product as is by changing the published property from false to true, then you will get an error.
Error: "Missing variants Colour, Filter Colour, and Product Lead Time must be selected"
The error explained: Marketplacer does not allow a product (advert) to publish without certain information including the correct prototype information, which includes the Feature Option values and Variant Option values.
Update advert information to enable publishing
Variant and Feature Option values can be added using an API property called "Relationships". Relationships pull through the values defined under a product prototype.
Here’s what to do next:
- Create a "relationship" property to add Feature Option Values.
- Use the "relationship" property to add Variant Option Values, if applicable.
- Add a product image.
Step 1: Create a "relationship" property to add feature option values
This is what the endpoint call should look like. Note the addition of “relationships”:
ENDPOINT: {{base_url}}/api/v2/client/adverts
Request: POST
Payload: Relationship information included
The product has been created with all the feature options, and looks like this:
Relationship IDs
You will notice that the payload showed the relationship values as ID calls. These were created from the following request.
ENDPOINT: {{base_url}}/api/v2/taxons/gaming-headsets
Request: GET
The request uses the endpoint to pull all the values based on an ID given to each Taxon.
Using the example, you can see the first 'option_value' selected is 'id' 1124 which maps to 'Freight Account' as shown in this example.
The other 'option values' are mapped using the same method.
Step 2: Use the 'relationship' property to add variant option values
To know more, please visit the API documentation.
Required string for the API call:
Endpoint: {{base_url}}/api/v2/client/adverts/100109824/variants/new
Payload: Just shows the Option Types section, with relationships.
Now we can create the variant.
ENDPOINT: {{base_url}}/api/v2/client/adverts/100109824/variants
Request: POST
Payload: Includes Variant Option Values, called via the Taxon ID.
You have created a variant. Here’s what it looks like in the Seller view.
Step 3: Add an image
All adverts need an image to be publishable. For more information, visit our API documentation.
ENDPOINT: {{base_url}}/api/v2/client/adverts/100109823/images
Request: POST
Related articles