Skip to content

Instantly share code, notes, and snippets.

@ikraamg
Created May 18, 2022 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikraamg/6b8cff00ec4d74250c564bb9895fe03f to your computer and use it in GitHub Desktop.
Save ikraamg/6b8cff00ec4d74250c564bb9895fe03f to your computer and use it in GitHub Desktop.
Dynamic Promotion API example
curl --location --request PUT 'http://localhost:3000/api/orders/CHORD-579656375/line_items/41' \
--header 'X-Spree-Order-Token: QDpqfwxE2eaUr7oo41B6Zw' \
--header 'Content-Type: application/json' \
--data-raw '{
"sku": "product-6",
"quantity": 3,
"dynamic_promotions_attributes": [
{
"code": "existing_code_to_destroy",
"_destroy": 1
},
{
"code": "new_code"
}
],
"metadata": {
"metadata": 1234567890
}
}'
curl --location --request PUT 'http://localhost:3000/api/orders/CHORD-579656375' \
--header 'X-Spree-Order-Token: <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"order": {
"line_items_attributes": [
{
"sku": "product-2",
"quantity": 8,
"dynamic_promotions_attributes": [
{
"code": "new_code"
// "_destroy": 1
},
{
"code": "new_new_code"
}
],
"metadata": {
"some_metadata": 1234567890
}
}
]
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment