DiscountList Resource
Use the DiscountList
resource to fetch multiple discounts.
Note that this resource specifically covers item pricing discounts, not marketing coupons.
Resources:
Schema type
Use discount-list
to reference this resource in the template schema.
Querying
List Rendering
When nothing is defined, the first page of discounts will return as a result.
{% schema %}
{
"discounts": {
"type": "discount-list"
}
}
{% endschema %}
// page json
{
props: {
"discounts": {}
}
}
Pagination
- pagination.page_size number
- Default: 100
Control the page size of the discount list request. Does not apply to
filters.ids
requests.{ "pagination": { "page_size": 50 } }
- pagination.page number
- Default: 1
Control the page number of the discount list request. Does not apply to
filters.ids
requests.{ "pagination": { "page_size": 50, "page": 2 } }
-
pagination.meta_name string nullable
Used to set the name for this resource when loaded via a resource function for use with the
paginate_meta
function. Note that this field is ignored for resources loaded via a template’s schema, as the resource name itself is used for thepaginate_meta
function. - pagination.page_query_param string
- Default:
{property_name}_page
Control the query param that loads the page number of the discount list. By default, the query param used is the name of the property with
_page
attached as a suffix.{ "all_discounts": { "pagination": { "page_size": 50, "page_query_param": "page" } } }
Results in
mysite.com/shop?page=4
to load the fourth page of the correlating discount list. By default, the pagination query parameter would beall_discounts_page
if no query parameter override was provided - Default:
Output
[{
"__SO_RESOURCE_TYPE__": "discount", // internally used resource property. do not modify.
"resource_type": "DISCOUNT",
"id": "2NTAFERGD4ANGBTWYVU32K5X",
"name": "$10.00 Off Entire Order",
"discount_type": "FIXED_AMOUNT",
"amount_money": {
"amount": 1000,
"currency": "USD",
"formatted": "$10.00"
}
}]
Discount resources
Discount
A discount.
Field | Type | Description |
---|---|---|
absent_at_location_ids | String[] | The store location Square IDs that are excluded from this discount, if present_at_all_locations is true |
present_at_location_ids | String[] | The store location Square IDs that are included in this discount, if present_at_all_locations is false |
all_items | Boolean | If set to true, the discount applies to every item in the catalog |
discount_tags | String[] | A list of string tags that indicate certain features of the discount |
discount_type | String | Indicates whether the discount is a fixed amount or percentage, or entered at the time of sale |
display_strings | DisplayStrings | A dictionary of strings for displaying discount information to the buyer |
exact_quantity | Number | If set, there must be exactly this many applicable items in the cart for the discount to apply |
exclude_square_online_item_ids | String[] | Item IDs in Square Online that are excluded from this discount |
exclude_item_ids | String[] | Item IDs in Square that are excluded from this discount |
excluded_quantity | Number | If set, the discount will not apply to this many of the items in the cart. For example, in a Buy-1-Get-1 type of discount, this would be 1 |
id | String | Discount ID |
included_quantity | Number | If set, the discount will only apply to a maximum of this many items in the cart |
match_square_online_item_ids | String[] | Item IDs in Square Online that this discount applies to |
match_item_ids | String[] | Item IDs in Square that this discount applies to |
max_value | String | For a percentage discount, the maximum absolute value of the discount, formatted as a string |
maximum_amount_money | Money | For a percentage discount, the maximum absolute value of the discount |
min_quantity | Number | If set, there must be at least this many applicable items in the cart for the discount to apply |
min_value | String | The minimum order subtotal (before discounts or taxes are applied) that must be met before this rule may be applied, formatted as a string |
minimum_order_amount_money | Money | The minimum order subtotal (before discounts or taxes are applied) that must be met before this rule may be applied |
name | String | The discount name |
percentage | Number | The percentage amount of the discount if it’s a FIXED_PERCENTAGE type discount |
amount_money | Money | The amount of the discount if it’s a FIXED_AMOUNT type discount |
present_at_all_locations | Boolean | Whether the discount applies to all store locations or not |
time_periods | String[] | A list of unique IDs for the catalog time periods when this pricing rule is in effect. If left unset, the pricing rule is always in effect |
valid_from_date | String | Represents the date the Pricing Rule is valid from. Represented in RFC 3339 full-date format (YYYY-MM-DD) |
valid_until_date | String | Represents the date the Pricing Rule is valid until. Represented in RFC 3339 full-date format (YYYY-MM-DD) |
DisplayStrings
Display strings that provide information for a discount.
Field | Type | Description |
---|---|---|
badge_text | String | A short string explaining the discount rules meant to be displayed as an item badge |
details | String[] | Additional details about the discount rules |
discount_formatted | String | If a percentage discount, this will be a percentage. If a fixed amount, this will be a formatted money amount |
excluded_badge_text | String | Badge text to display for items included in a BOGO discount |
excluded_item_detail_title | String | Title text for “Buy one” items as part of the BOGO discount, if applicable |
excluded_summary_text | String | Text explaining the BOGO discount rules, if applicable |
expiration_detail | String | Formatted text describing when the discount expires |
included_item_detail_title | String | Title text for “Get one” items as part of the BOGO discount, if applicable |
recurring_details | String[] | Formatted text describing the time intervals the discount is enabled for |
summary_text | String | A short string explaining the discount rules |
Money
Information about monetary amounts.
Field | Type | Description |
---|---|---|
amount | Number | Amount in the smallest subunit of the given currency |
currency | String | The ISO 4217 three-letter currency code |
formatted | String | Amount formatted with the symbol of the given currency. Formatted according to the site’s locale |