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 actual prices and compare at prices. 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:actualPrice
is set at $100.compareAtPrice
, this price will indicate to your client what is the price of the product before the sale. call Bulk Update Product Variants By Filter endpoint with variant with desired compareAtPrice
and actualPrice
:After this call example product will have compareAtPrice
100$ and actualPrice
90$.
a) If you want to adjust all actual prices by some specific amount or percentage which depends on original actualPrice
value call Bulk Adjust Product Variants By Filter. For example if you want to decrease current actual prices by 10% pass next body:
After this call example product will have compareAtPrice
100$ and actualPrice
81$.
b) If you want to calculate new actualPrice
from compareAtPrice
by applying some discount to it call Bulk Adjust Product Variants By Filter with actualPriceFromCompareAtPrice
. For example if you want to set actualPrice
as 20% discount from compareAtPrice
pass next body:
After this call example product will have compareAtPrice
100$ and actualPrice
80$.
c) If you want to set exact actualPrice
same for all variants of all products call Bulk Update Product Variants By Filter endpoint with variant with desired actualPrice
:
After this call example product will have compareAtPrice
100$ and actualPrice
75$.
The Product object includes predefined fields that cannot be removed or renamed. However, there may be instances where you need to add additional fields to accommodate specific flows or use cases for your application.
For example, consider a real estate app that needs to store information about the total area and the type of unit (such as whether it is an apartment or a house). This can be achieved using the extendedFields
field of the Product object.
Before proceeding, you may want to review our documentation on data extensions or schema plugins here.
@my-user-name/real-estate-app
.This defines two fields: areaInSqm
, which includes minimum value validation, and unitType
, which includes maximum length validation. Both fields can be read and written by your app as well as by users, such as the site owner.
3. Save your extension. Please note that, according to this guide, you must have your app approved before you can proceed with testing.
4. Once your app is approved, you can click "Test Your App" and select the site where you want to install it. Be sure to grant the app permissions to read and write to the stores catalog.
5. You can now create a product with extended fields by calling the Create Product endpoint or update an existing product by calling the Update Product endpoint. In your request, include the extendedFields
object with your namespace and the relevant field values.
Alternatively, you can update a product's extended fields without passing a revision by using the Update Extended Fields endpoint.
6. When you call the Get Product endpoint, the response will include the extendedFields
object with your namespace.