Promotion Info
Bold Price Rules allows you to create price rules that offer flexible discounts and promotions. Promotion enablement refers to the ability to display to customers what promotions their order qualifies for. Promotion enablement is designed to incentivize customers and encourage them to complete their purchase by advertising current offers.
Prerequisites
Before you get started, learn how to create a price rule using Managing Price Rules.
Creating rulesets with promotion information
Price Rules provides a generic way to configure promotional information for the purpose of displaying on the product page and cart page. You can specify promotion information within rulesets using the public_name
attribute.
Sample Rulesets
{
"ruleset": {
"product_selection": {
"type": "PRODUCTS_ALL"
},
"rules": [
{
"conditions": [],
"actions": [
{
"type": "PRICE_ADJUST_PERCENT",
"value": -20
}
],
"type": "DISCOUNT"
}
],
"active": true,
"priority": 100,
"internal_name": "sample promotion ruleset",
"public_name": "20% off on this item"
}
}
Retrieve promotion information
If you have enabled Price Rules storefront Javascript, you can refer to promotion message to manage the display. You can also retrieve the promotion information from Price Rules API. The public message is accessible from the endpoints below.
Sample Request (best product price)
curl --request POST 'https://api.boldcommerce.com/price_rules/storefront/v2/shops/27698659388/price' \
--header 'Bold-API-Version-Date: 2022-05-01' \
--header 'Content-Type: application/json' \
--data '{
"items": [
{
"price": 9000,
"id": "test-sku"
}
],
"lineItemIdType": "sku"
}'
Sample Response (best product price)
{
"pre_best_price_log_id": "PRE_303",
"actions": [
{
"type": "BEST_ITEM_PRICE",
"sku": "test-sku",
"variant_id": 30988866617404,
"value": 7200,
"rule": [
{
"id": 25,
"eid": null,
"rule_set_id": 2,
"rule_set_eid": "testName",
"rule_set_public_message": "20% off",
"type": "DISCOUNT"
}
]
}
]
}
Sample Request (ruleset fetch)
curl --request GET 'https://api.boldcommerce.com/price_rules/storefront/v2/shops/27698659388/rulesets?products=4311272947772' \
--header 'Bold-API-Version-Date: 2022-05-01'
Sample Response (ruleset fetch)
{
"message": "Successfully fetched rulesets",
"data": {
"rulesets": [
{
"id": 2,
"app_slug": "pre-plugin",
"external_id": "testName",
"public_name": "20% off on this item",
"sync_percent": 100,
"priority": 100,
"expiry_date": null,
"rules": [
{
"conditions": [],
"actions": [
{
"type": "PRICE_ADJUST_PERCENT",
"value": -20
}
],
"type": "DISCOUNT",
"id": 25
}
],
"product_selection": {
"type": "PRODUCTS_ALL"
}
},
{
"id": 2,
"app_slug": "pre-bac-staging",
"external_id": "testName",
"public_name": "50% off on this item",
"sync_percent": 100,
"priority": 100,
"expiry_date": null,
"rules": [
{
"conditions": [],
"actions": [
{
"type": "PRICE_ADJUST_PERCENT",
"value": -50
}
],
"type": "DISCOUNT",
"id": 25
}
],
"product_selection": {
"type": "PRODUCTS_ALL"
}
}
],
"shop_options": {
"rule_filter": true,
"mayhem_variant": true,
"cashier_addition_info": true,
"multi_currency": true
}
}
}