# Shopify: Discounts

## Description

* Each record represents a unique discount, enriched with information about its associated price\_rule and metrics regarding orders and abandoned checkouts.

## Supported Data Sources

* <img src="https://fivetran.com/integrations/shopify/resources/shopify.svg" alt="" data-size="line"> Shopify

## Columns

| Type | Name                                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ---- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|      | \_fivetran\_synced                                | The time when a record was last updated by Fivetran.                                                                                                                                                                                                                                                                                                                                                                                                                                |
|      | code                                              | The case-insensitive discount code that customers use at checkout. Shopify recommends this map onto the associated `price_rule.title`.                                                                                                                                                                                                                                                                                                                                              |
|      | created\_at                                       | The date and time (ISO 8601 format) when the discount code was created.                                                                                                                                                                                                                                                                                                                                                                                                             |
|      | discount\_code\_id                                | The ID for the discount code.                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|      | price\_rule\_id                                   | The ID for the price rule.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|      | updated\_at                                       | The date and time (ISO 8601 format) when the discount code was updated.                                                                                                                                                                                                                                                                                                                                                                                                             |
|      | usage\_count                                      | The number of times that the discount code has been redeemed.                                                                                                                                                                                                                                                                                                                                                                                                                       |
|      | allocation\_limit                                 | The number of times the discount can be allocated on the cart - if eligible. For example a Buy 1 hat Get 1 hat for free discount can be applied 3 times on a cart having more than 6 hats, where maximum of 3 hats get discounted - if the allocation\_limit is 3. Empty (null) allocation\_limit means unlimited number of allocations.                                                                                                                                            |
|      | allocation\_method                                | The allocation method of the price rule. Valid values include `each` (the discount is applied to each of the entitled items. For example, for a price rule that takes $15 off, each entitled line item in a checkout will be discounted by $15) and `across` (the calculated discount amount will be applied across the entitled items. For example, for a price rule that takes $15 off, the discount will be applied across all the entitled items).                              |
|      | price\_rule\_created\_at                          | The date and time (ISO 8601 format) when the price rule was created.                                                                                                                                                                                                                                                                                                                                                                                                                |
|      | customer\_selection                               | The customer selection for the price rule. Valid values include `all` (the price rule is valid for all customers) and `prerequisite` (the customer must either belong to one of the customer segments specified by customer\_segment\_prerequisite\_ids, or be one of the customers specified by prerequisite\_customer\_ids).                                                                                                                                                      |
|      | ends\_at                                          | The date and time (ISO 8601 format) when the price rule ends. Must be after starts\_at.                                                                                                                                                                                                                                                                                                                                                                                             |
|      | is\_once\_per\_customer                           | Boolean representing whether the generated discount code will be valid only for a single use per customer. This is tracked using customer ID.                                                                                                                                                                                                                                                                                                                                       |
|      | prereq\_min\_quantity                             | If `customer_selection` is `prerequisite`, the minimum number of items for the price rule to be applicable. The quantity of an entitled cart item must be greater than or equal to this value.                                                                                                                                                                                                                                                                                      |
|      | prereq\_max\_shipping\_price                      | If `customer_selection` is `prerequisite`, the maximum shipping price for the price rule to be applicable. The shipping price must be less than or equal to this value                                                                                                                                                                                                                                                                                                              |
|      | prereq\_min\_subtotal                             | If `customer_selection` is `prerequisite`, the minimum subtotal for the price rule to be applicable. The subtotal of the entitled cart items must be greater than or equal to this value for the discount to apply.                                                                                                                                                                                                                                                                 |
|      | prereq\_min\_purchase\_quantity\_for\_entitlement | If `customer_selection` is `prerequisite`, the prerequisite purchase for a Buy X Get Y discount. The minimum purchase amount required to be entitled to the discount.                                                                                                                                                                                                                                                                                                               |
|      | prereq\_buy\_x\_get\_this                         | If `customer_selection` is `prerequisite`, in a Buy/Get ratio for a Buy X Get Y discount, this is the offered 'get' quantity.                                                                                                                                                                                                                                                                                                                                                       |
|      | prereq\_buy\_this\_get\_y                         | If `customer_selection` is `prerequisite`, in a Buy/Get ratio for a Buy X Get Y discount, this defines the necessary 'buy' quantity.                                                                                                                                                                                                                                                                                                                                                |
|      | starts\_at                                        | The date and time (ISO 8601 format) when the price rule starts.                                                                                                                                                                                                                                                                                                                                                                                                                     |
|      | target\_selection                                 | The target selection method of the price rule. Valid values include `all` (the price rule applies the discount to all line items in the checkout) and `entitled` (the price rule applies the discount to selected entitlements only).                                                                                                                                                                                                                                               |
|      | target\_type                                      | The target type that the price rule applies to. Valid values include `line_item` (the price rule applies to the cart's line items) and `shipping_line` (the price rule applies to the cart's shipping lines).                                                                                                                                                                                                                                                                       |
|      | title                                             | The title of the price rule. This is used by the Shopify admin search to retrieve discounts. It is also displayed on the Discounts page of the Shopify admin for bulk discounts. Shopify recommends that this map onto the associated `discount_code.code`.                                                                                                                                                                                                                         |
|      | price\_rule\_updated\_at                          | The date and time (ISO 8601 format) when the price rule was updated.                                                                                                                                                                                                                                                                                                                                                                                                                |
|      | usage\_limit                                      | The maximum number of times the price rule can be used, per discount code.                                                                                                                                                                                                                                                                                                                                                                                                          |
|      | value                                             | The value of the price rule. If if the value of `target_type` is `shipping_line`, then only -100 is accepted. The value must be negative.                                                                                                                                                                                                                                                                                                                                           |
|      | value\_type                                       | The value type of the price rule. Valid values include `fixed_amount` (applies a discount of value as a unit of the store's currency. For example, if value is -30 and the store's currency is USD, then $30 USD is deducted when the discount is applied) and `percentage` (applies a percentage discount of value. For example, if value is -30, then 30% will be deducted when the discount is applied).If `target_type` is `shipping_line`, then only `percentage` is accepted. |
|      | total\_order\_discount\_amount                    | Total monetary amount (in shop currency) of discounts taken off of orders.                                                                                                                                                                                                                                                                                                                                                                                                          |
|      | total\_abandoned\_checkout\_discount\_amount      | Total monetary amount (in shop currency) of discounts taken off abandoned checkout orders.                                                                                                                                                                                                                                                                                                                                                                                          |
|      | total\_order\_line\_items\_price                  | Total monetary amount (in shop currency) of line items for orders that have used this discount.                                                                                                                                                                                                                                                                                                                                                                                     |
|      | total\_order\_shipping\_cost                      | Total shipping costs for orders that used this discount.                                                                                                                                                                                                                                                                                                                                                                                                                            |
|      | total\_abandoned\_checkout\_shipping\_price       | Total projected shipping costs for abandoned checkouts that applied this discount first.                                                                                                                                                                                                                                                                                                                                                                                            |
|      | total\_order\_refund\_amount                      | Total refunded amount (in shop currency) for orders that used this discount code.                                                                                                                                                                                                                                                                                                                                                                                                   |
|      | count\_customers                                  | Count of distinct customers who placed orders using this discount.                                                                                                                                                                                                                                                                                                                                                                                                                  |
|      | count\_customer\_emails                           | Count of distinct customer emails who placed orders using this discount.                                                                                                                                                                                                                                                                                                                                                                                                            |
|      | avg\_order\_discount\_amount                      | Average amount (in shop currency) of discount taken off orders.                                                                                                                                                                                                                                                                                                                                                                                                                     |
|      | source\_relation                                  | The schema or database this record came from if you are making use of the `shopify_union_schemas` or `shopify_union_databases` variables, respectively. Empty string if you are not using either of these variables to union together multiple Shopify connectors.                                                                                                                                                                                                                  |
|      | count\_orders                                     | Count of orders in which this discount code was applied.                                                                                                                                                                                                                                                                                                                                                                                                                            |
|      | count\_abandoned\_checkouts                       | Count of abandoned checkouts in which this discount code was applied.                                                                                                                                                                                                                                                                                                                                                                                                               |
|      | count\_abandoned\_checkout\_customers             | Distinct count of customers who applied this discount in a checkout that they abandoned.                                                                                                                                                                                                                                                                                                                                                                                            |
|      | count\_abandoned\_checkout\_customer\_emails      | Distinct count of customer emails who applied this discount in a checkout that they abandoned.                                                                                                                                                                                                                                                                                                                                                                                      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://endash-guidance-docs.gitbook.io/cigro-data-templates/data-model-templates/shopify-discounts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
