This article shares a possible use case your app could support, as well as sample flows that could support this use case. This can be a helpful jumping-off point as you plan your app's implementation.
Help merchants to manage their products by using categories. For this we will be using the Categories API.
"@wix/stores"
to the treeReference.appNamespace
field.category.id
from the response.items
you want to add to the category. After products added to category you can rearrange them for example to promote some products to be displayed in the beginning. Note that you can arrange only 100 products, more products can be added but you cannot control arrangement of them. Call Set Arranged Items endpoint. Pass exactly same params as in step 2 but now items
must be in same order in which you want to see them.
Replace <categoryId>
with real category id from step 1. Pay attention to sort.selectItemsBy
parameter where you must pass filter by categoryId, this allows you to sort products by arrangement that you set in CategoriesService on step 3.
Before big sale merchant might want to prepare store by creating a new category for products on sale, adding ribbons to products to catch visitors' attention and of course setting new sale price. Let's see how to do it step by step.
ribbon.id
that you received in response.filter
send filter by category id. In product
send only ribbon
. So your request will look like:
a) If you want to adjust all sale prices by some specific amount or percentage which depends on original sale price value call Bulk Adjust Product Variants By Filter. For example if you want to decrease current sale prices by 10% pass next body:
After this call example product will have basePrice 100$ and salePrice 81$.
b) If you want to calculate new sale prices from base price by applying some discount to it call Bulk Adjust Product Variants By Filter with salePriceFromSasePrice
. For example if you want to set sale as 20% discount from base price pass next body:
After this call example product will have basePrice 100$ and salePrice 80$.
c) If you want to set exact sale price same for all variants of all products call Bulk Update Product Variants By Filter endpoint with variant with desired sale price:
After this call example product will have basePrice 100$ and salePrice 75$.