Create a Modifier
POSThttps://euwest.api.elasticpath.com/pcm/pricebooks/:pricebookID/modifiers
You can use price modifiers to change the price property of child products. By default, child products inherit the same price as their base products. Using price modifiers, you can enable child products to inherit a different price. This enables you to configure the price of child products, for example, to be lower than its base product, without having to individually update the price of your child products. There are three types of price modifier.
Request
Path Parameters
pricebookID stringrequired
Unique identifier of a Price Book
- application/json
Body
required
The price modifier to create within a price book.
data objectrequired
Responses
- 201
- default
The created price modifier
- application/json
- Schema
- Example (from schema)
Schema
data objectrequired
links object
{
"data": {
"type": "price-modifier",
"pricebook_external_ref": "a-pricebook-external-ref",
"attributes": {
"external_ref": "external-ref",
"currencies": {
"USD": {
"amount": 100,
"includes_tax": false,
"tiers": {
"min_5": {
"minimum_quantity": 5,
"amount": 50
}
}
},
"CAD": {
"amount": 127,
"includes_tax": false,
"tiers": {
"min_10": {
"minimum_quantity": 10,
"amount": 100
}
}
},
"GBP": {
"amount": 73,
"includes_tax": true,
"tiers": {
"min_20": {
"minimum_quantity": 20,
"amount": 60
}
}
}
},
"name": "large-supplement",
"modifier_type": "price_equals",
"created_at": "2020-09-22T09:00:00Z",
"updated_at": "2020-09-22T09:00:00Z"
},
"id": "37f2eed6-0bea-4d0b-a3c6-24cc76143bfd",
"meta": {
"owner": "store"
}
},
"links": {
"self": "/pcm/pricebooks/4c45e4ec-26e0-4043-86e4-c15b9cf985a7/modifiers/f5bd1fc7-48a2-40ac-88dd-2bd9985050cd"
}
}
Unexpected error.
- application/json
- Schema
- Example (from schema)
Schema
errors object[]
{
"errors": [
{
"detail": "The modifier already exists",
"status": "409",
"title": "conflict"
}
]
}
Authorization: Authorization
name: Authorizationtype: httpin: headerscheme: bearer
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X POST 'https://euwest.api.elasticpath.com/pcm/pricebooks/:pricebookID/modifiers' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
"data": {
"type": "price-modifier",
"attributes": {
"currencies": {
"USD": {
"amount": 100,
"includes_tax": false,
"tiers": {
"min_5": {
"minimum_quantity": 5,
"amount": 50
}
}
},
"CAD": {
"amount": 127,
"includes_tax": false,
"tiers": {
"min_10": {
"minimum_quantity": 10,
"amount": 100
}
}
},
"GBP": {
"amount": 73,
"includes_tax": true,
"tiers": {
"min_20": {
"minimum_quantity": 20,
"amount": 60
}
}
}
},
"name": "large-supplement",
"modifier_type": "price_equals",
"external_ref": "external-ref"
}
}
}'
ResponseClear