Manage prices for multiple products
Adobe Commerce provides REST endpoints that allow you to update multiple special prices, tier prices, base prices, or cost values with a single call.
The calls that update special and tier prices mimic the options available on a product's Advanced Pricing screen in Admin.
Manage special prices
The SpecialPriceStorageInterface service provides the means to efficiently schedule special prices for one or more products in a store's catalog. When you use these calls, you do not provide detailed information about the product.
The POST /V1/products/special-price call sets special prices for the following product types:
- Simple
- Bundle
- Virtual
- Downloadable
Service Name:
SpecialPriceStorageInterface
REST Endpoints:
POST /V1/products/special-price
POST /V1/products/special-price-information
POST /V1/products/special-price-delete
SpecialPriceStorageInterface Parameters:
pricestore_idskuskusprice_fromYYYY-MM-DD hh:mm:ss. The specified time must be later than the current time.price_toYYYY-MM-DD hh:mm:ss If no value is specified, the special price does not expire.Set special prices
All calls to set special prices must include the store_id, sku, and price parameters. If the call is sent to an Adobe Commerce installation, the call must also include the price_from parameter. If the call is sent to a Magento Open Source installation, then the price_from parameter is optional.
For bundled products, the value of the price parameter must be expressed as a discount percentage.
You can set multiple special prices in a single call, as shown in the example below. The call sets special prices for a simple product, downloadable product, and bundle product for two days.
data-variant=info
data-slots=text
price_from and price_to trigger a catalog schedule, which is currently only supported on a global price scope. Overlapping date ranges on multiple stores will trigger an error that states: "Future Update already exists in this time range. Set a different range and try again."Sample Usage:
POST <host>/rest/<store_code>/V1/products/special-price
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"prices": [
{
"price": 29.95,
"store_id": 0,
"price_from": "2017-07-15 00:00:00",
"price_to": "2017-07-16 23:59:59",
"sku": "24-WB06"
},
{
"price": 19.95,
"store_id": 0,
"price_from": "2017-07-15 00:00:00",
"price_to": "2017-07-16 23:59:59",
"sku": "240-LV06"
},
{
"price": 5,
"store_id": 0,
"price_from": "2017-07-15 00:00:00",
"price_to": "2017-07-16 23:59:59",
"sku": "24-WG080"
}
]
}
Response
// Returns an empty array
[]
Get special prices
The following call returns the special price information for three SKU values.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/special-price-information
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"skus": [
"24-WB06",
"240-LV06",
"24-WG080"
]
}
Response
[
{
"price": 29.949999999999999,
"store_id": 0,
"sku": "24-WB06",
"price_from": "2017-07-15 00:00:00",
"price_to": "2017-07-16 23:59:59"
},
{
"price": 19.949999999999999,
"store_id": 0,
"sku": "240-LV06",
"price_from": "2017-07-15 00:00:00",
"price_to": "2017-07-16 23:59:59"
},
{
"price": 5,
"store_id": 0,
"sku": "24-WG080",
"price_from": "2017-07-15 00:00:00",
"price_to": "2017-07-16 23:59:59"
}
]
Delete a special price
If any item to be deleted has an invalid price, store_id, sku or date, Commerce marks the item as failed and excludes it from the delete list. Valid items are deleted as requested.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/special-price-delete
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"prices": [
{
"price": 29.95,
"store_id": 0,
"price_from": "2017-07-15 00:00:00",
"price_to": "2017-07-16 23:59:59",
"sku": "24-WB06"
},
{
"price": 19.95,
"store_id": 0,
"price_from": "2017-07-15 00:00:00",
"price_to": "2017-07-16 23:59:59",
"sku": "240-LV06"
},
{
"price": 5,
"store_id": 0,
"price_from": "2017-07-15 00:00:00",
"price_to": "2017-07-16 23:59:59",
"sku": "24-WG080"
}
]
}
Response
// Returns an empty array
[]
Manage tier prices
Tier pricing offers a quantity discount to members of a specific customer group and website. The TierPriceStorageInterface service provides an efficient means to set tier prices for one or more products without requiring detailed information about each product.
You can use REST endpoints to set tier prices for the following product types:
Service Name:
TierPriceStorageInterface
REST Endpoints:
POST /V1/products/tier-prices
PUT /V1/products/tier-prices
POST /V1/products/tier-prices-information
POST /V1/products/tier-prices-delete
TierPriceStorageInterface Parameters:
priceprice_typefixed (the set price) or discount (percent discount)website_idskuskuscustomer_groupquantitySet tier prices
The POST /V1/products/tier-prices call adds new tier prices or updates existing prices. You can specify tier prices for multiple products in the same call.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/tier-prices
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"prices": [
{
"price": 10,
"price_type": "fixed",
"website_id": 0,
"sku": "24-UG04",
"customer_group": "General",
"quantity": 3
},
{
"price": 8,
"price_type": "fixed",
"website_id": 0,
"sku": "24-UG04",
"customer_group": "General",
"quantity": 5
},
{
"price": 6,
"price_type": "fixed",
"website_id": 0,
"sku": "24-UG04",
"customer_group": "General",
"quantity": 10
}
]
}
Response
// Returns an empty array
[]
Replace existing tier prices
The replace request removes all existing tier prices for a specified product and adds new rows for this same product instead.
The following example removes the $10 tier price for sku 24-UG04 and changes the customer group for the sku's other tier prices.
Sample Usage:
PUT <host>/rest/<store_code>/V1/products/tier-prices
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"prices": [
{
"price": 8,
"price_type": "fixed",
"website_id": 0,
"sku": "24-UG04",
"customer_group": "NOT LOGGED IN",
"quantity": 5
},
{
"price": 5,
"price_type": "fixed",
"website_id": 0,
"sku": "24-UG04",
"customer_group": "NOT LOGGED IN",
"quantity": 310
}
]
}
Response
// Returns an empty array
[]
Get tier prices
Commerce returns all active tier prices for the specified list of skus.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/tier-prices-information
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"skus": [
"24-UG04",
"24-UG01"
]
}
Response
[
{
"price": 8,
"price_type": "fixed",
"website_id": 0,
"sku": "24-UG04",
"customer_group": "General",
"quantity": 5
},
{
"price": 6,
"price_type": "fixed",
"website_id": 0,
"sku": "24-UG04",
"customer_group": "General",
"quantity": 10
},
{
"price": 10,
"price_type": "fixed",
"website_id": 0,
"sku": "24-UG04",
"customer_group": "General",
"quantity": 3
},
{
"price": 5,
"price_type": "discount",
"website_id": 0,
"sku": "24-UG01",
"customer_group": "General",
"quantity": 3
}
]
Delete tier prices
You must specify each tier price that is to be deleted. You can delete multiple tier prices in a single call.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/tier-prices-delete
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"prices": [
{
"price": 10,
"price_type": "fixed",
"website_id": 0,
"sku": "24-UG04",
"customer_group": "General",
"quantity": 3
}
]
}
Response
// Returns an empty array
[]
Manage base prices
A base price is the price of a product, before any discounts or extra costs (such as shipping or taxes) are applied. The BasePriceStorageInterface service provides an efficient means to set base prices for one or more products without requiring detailed information about each product.
data-variant=info
data-slots=text
REST Endpoints:
POST /V1/products/base-prices
POST /V1/products/base-prices-information
BasePriceStorageInterface Parameters:
pricestore_idskuskusSet base prices
The POST /V1/products/base-prices call can set base prices for the following types of products:
- Simple
- Virtual
- Downloadable
- Bundle (fixed price type only)
The following example sets the base price for a simple and a downloadable product.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/base-prices
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"prices": [
{
"price": 12,
"store_id": 0,
"sku": "24-UG04"
},
{
"price": 22,
"store_id": 0,
"sku": "240-LV06"
}
]
}
Response
// Returns an empty array
[]
Get base prices
The following example returns the base prices for a simple and a downloadable product.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/base-prices-information
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"skus": [
"24-UG04",
"240-LV06"
]
}
Response
[
{
"price": 12,
"store_id": 0,
"sku": "24-UG04"
},
{
"price": 22,
"store_id": 0,
"sku": "240-LV06"
}
]
Manage cost values
The cost is the actual cost of a product. Tracking costs is optional, but having this information available can be helpful when you are setting discounts.
REST Endpoints:
POST /V1/products/cost
POST /V1/products/cost-information
POST /V1/products/cost-delete
CostStorageInterface Parameters:
coststore_idskuskusSet cost values
The POST /V1/products/cost call can set the cost values for the following types of products:
- Simple
- Virtual
- Downloadable
The following example sets the cost value for a simple and a downloadable product.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/cost
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"prices": [
{
"cost": 18,
"store_id": 0,
"sku": "24-WB03"
},
{
"cost": 2,
"store_id": 0,
"sku": "240-LV09"
}
]
}
Response
// Returns an empty array
[]
Get cost values
The following example returns the cost values for a simple and a downloadable product.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/cost-information
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"skus": [
"24-WB03",
"240-LV09"
]
}
Response
[
{
"cost": 18,
"store_id": 0,
"sku": "24-WB03"
},
{
"cost": 2,
"store_id": 0,
"sku": "240-LV09"
}
]
Delete cost values
The following example deletes the previously-defined cost values for a simple and a downloadable product.
Sample Usage:
POST <host>/rest/<store_code>/V1/products/cost-delete
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"skus": [
"24-WB03",
"240-LV09"
]
}
Response
`true`
// indicating the cost values were deleted