Displaying Items for Sale
For Weedmaps Catalog API, you can control the quantity and price of an item for sale by using the Catalog Item resource.
A catalog_item
resource is what ties everything together. It connects the product_variant
to a catalog
, assigning its price and availability in the process.
To create our first catalog_item
, we will use the API Reference Catalog Item POST to generate the cURL command. Required fields in the payload are prince_in_cents
, and a catalog
and product_variant
in the relationship. While available
and online_orderable
are required fields, they default to false
and true
respectively so we do not need to include them in the payload. However, your catalog_item
needs to have available
set to true
for it to be displayed.
Your generated cURL command should look similar to our example below.
curl --globoff \
--request POST \
--url 'https://api-g.weedmaps.com/catalog/v1/catalog_items?scope_by[organization_id]=da78484e-4c16-4a85-b78e-18664c323623' \
--header 'accept: application/vnd.api+json' \
--header 'authorization: Bearer [ACCESS TOKEN HERE]' \
--header 'content-type: application/vnd.api+json' \
--data '{
"data": {
"attributes": {
"available": true,
"online_orderable": true,
"price_in_cents":4200
},
"relationships": {
"catalog": {
"data":{
"type": "catalogs",
"id":"f8382b94-7f0a-45bb-90b2-d3d70825a9e9"
}
},
"product_variant": {
"data": {
"type": "product_variants",
"id":"76a159be-1fd6-4726-90fa-ec814ec68d3a"
}
}
},
"type": "catalog_items"
}
}'
Be sure to save the
catalog_item
ID from your response as it will be needed later in the guide.
Congratulations!
Your product is now displayed and available for sale on your test listing page!
Updated 7 months ago