> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nomadsarc.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Shopify Functions Limits for Slice 'n Save Discounts

> Understand Shopify Functions resource limits that affect how many discount items, conditions, and criteria you can use in Slice 'n Save.

Slice 'n Save is powered by Shopify Functions — Shopify's serverless compute layer for discount logic. Shopify imposes fixed and dynamic resource limits on all functions, which affects how many discount items, conditions, and criteria you can include in a single discount rule. This page outlines those limits so you can plan your discounts accordingly.

<Warning>
  You can create up to **25 Automatic discounts** at a time across your Shopify store. Once you reach this limit, you must delete an existing automatic discount before creating a new one.
</Warning>

## Per-Discount Type Limits

Different discount categories have different capacity limits. The tables below show approximate instruction counts at various item, condition, and criteria configurations. Use these as a guide when designing complex discount rules.

<Tabs>
  <Tab title="Amount off Products">
    <Accordion title="Basic">
      | Items | Conditions | Criteria | Instruction Count | Input   | Output  |
      | ----- | ---------- | -------- | ----------------- | ------- | ------- |
      | 1     | 3          | 3        | 2.9973 M          | 2.63 kB | 0.28 kB |
      | 5     | 3          | 3        | 4.5599 M          | 3.52 kB | 0.84 kB |
      | 10    | 3          | 3        | 6.9614 M          | 4.67 kB | 1.55 kB |
      | 16    | 3          | 3        | 10.4966 M         | 6.09 kB | 2.41 kB |
    </Accordion>

    <Accordion title="Advanced">
      | Items | Conditions | Criteria | Instruction Count | Input    | Output  |
      | ----- | ---------- | -------- | ----------------- | -------- | ------- |
      | 1     | 3          | 3        | 3.1187 M          | 2.63 kB  | 0.28 kB |
      | 5     | 3          | 3        | 4.8460 M          | 3.67 kB  | 0.84 kB |
      | 10    | 3          | 3        | 7.4354 M          | 0.84 kB  | 1.55 kB |
      | 15    | 3          | 3        | 10.4798 M         | 6.29 kB  | 2.27 kB |
      | 1     | 6          | 5        | 3.7736 M          | 3.50 kB  | 0.37 kB |
      | 5     | 6          | 5        | 6.7475 M          | 4.54 kB  | 1.31 kB |
      | 9     | 6          | 5        | 10.5827 M         | 5.58 kB  | 2.25 kB |
      | 35    | 1          | 1        | 10.9313 M         | 10.87 kB | 1.81 kB |
    </Accordion>
  </Tab>

  <Tab title="Amount off Order">
    <Accordion title="Basic">
      | Items | Conditions | Criteria | Instruction Count | Input    | Output  |
      | ----- | ---------- | -------- | ----------------- | -------- | ------- |
      | 1     | 4          | N/A      | 2.1336 M          | 2.30 kB  | 0.20 kB |
      | 15    | 4          | N/A      | 3.3181 M          | 5.59 kB  | 0.20 kB |
      | 30    | 4          | N/A      | 4.5777 M          | 9.14 kB  | 0.20 kB |
      | 45    | 4          | N/A      | 5.8114 M          | 12.68 kB | 0.20 kB |
      | 1     | 7          | N/A      | 2.4391 M          | 2.82 kB  | 0.20 kB |
      | 15    | 7          | N/A      | 3.6213 M          | 6.11 kB  | 0.20 kB |
      | 30    | 7          | N/A      | 4.8799 M          | 9.65 kB  | 0.20 kB |
    </Accordion>

    <Accordion title="Advanced">
      | Items | Conditions | Criteria | Instruction Count | Input    | Output  |
      | ----- | ---------- | -------- | ----------------- | -------- | ------- |
      | 1     | 4          | N/A      | 2.1452 M          | 2.27 kB  | 0.20 kB |
      | 15    | 4          | N/A      | 3.4848 M          | 5.93 kB  | 0.20 kB |
      | 30    | 4          | N/A      | 4.9076 M          | 9.86 kB  | 0.20 kB |
      | 45    | 4          | N/A      | 6.3122 M          | 13.79 kB | 0.20 kB |
      | 1     | 7          | N/A      | 2.4231 M          | 2.80 kB  | 0.20 kB |
      | 15    | 7          | N/A      | 3.7667 M          | 6.46 kB  | 0.20 kB |
      | 30    | 7          | N/A      | 5.1918 M          | 10.39 kB | 0.20 kB |
    </Accordion>
  </Tab>

  <Tab title="Amount off Shipping">
    <Accordion title="Basic">
      | Items | Conditions | Criteria | Instruction Count | Input    | Output  |
      | ----- | ---------- | -------- | ----------------- | -------- | ------- |
      | 1     | 4          | N/A      | 2.4555 M          | 3.78 kB  | 0.20 kB |
      | 15    | 4          | N/A      | 2.9070 M          | 5.94 kB  | 0.20 kB |
      | 30    | 4          | N/A      | 4.9108 M          | 10.65 kB | 0.20 kB |
      | 1     | 7          | N/A      | 2.7778 M          | 4.30 kB  | 0.20 kB |
      | 15    | 7          | N/A      | 3.9491 M          | 7.61 kB  | 0.20 kB |
      | 30    | 7          | N/A      | 5.2144 M          | 11.16 kB | 0.20 kB |
    </Accordion>

    <Accordion title="Advanced">
      | Items | Conditions | Criteria | Instruction Count | Input    | Output  |
      | ----- | ---------- | -------- | ----------------- | -------- | ------- |
      | 1     | 4          | N/A      | 2.4725 M          | 3.74 kB  | 0.20 kB |
      | 15    | 4          | N/A      | 3.8141 M          | 7.40 kB  | 0.20 kB |
      | 30    | 4          | N/A      | 5.2428 M          | 11.33 kB | 0.20 kB |
      | 1     | 7          | N/A      | 2.7610 M          | 4.26 kB  | 0.20 kB |
      | 15    | 7          | N/A      | 4.0823 M          | 7.91 kB  | 0.20 kB |
      | 30    | 7          | N/A      | 5.5090 M          | 11.84 kB | 0.20 kB |
    </Accordion>
  </Tab>

  <Tab title="Tiered Discounts">
    | Items | Conditions | Criteria | Instruction Count | Input   | Output  |
    | ----- | ---------- | -------- | ----------------- | ------- | ------- |
    | 1     | 1          | 2        | 3.3862 M          | 3.52 kB | 0.87 kB |
    | 15    | 1          | 2        | 8.7318 M          | 7.18 kB | 2.81 kB |
    | 19    | 1          | 2        | 10.7333 M         | 8.22 kB | 3.36 kB |
  </Tab>

  <Tab title="Quantity Break Discounts">
    | Items | Conditions | Criteria | Instruction Count | Input    | Output  |
    | ----- | ---------- | -------- | ----------------- | -------- | ------- |
    | 1     | 2          | 1        | 3.1627 M          | 3.47 kb  | 0.60 kb |
    | 15    | 2          | 1        | 6.6208 M          | 7.14 kb  | 1.89 kb |
    | 28    | 2          | 1        | 10.8969 M         | 10.54 kb | 3.08 kb |
    | 1     | 2          | 2        | 3.2942 M          | 3.64 kb  | 0.60 kb |
    | 21    | 2          | 2        | 10.8841 M         | 8.61 kb  | 2.35 kb |
  </Tab>

  <Tab title="BOGO Discounts">
    | Items | Conditions | Criteria | Instruction Count | Input    | Output  |
    | ----- | ---------- | -------- | ----------------- | -------- | ------- |
    | 8     | 2          | 1        | 5.2674 M          | 8.97 kb  | 0.6 kb  |
    | 8     | 2          | 2        | 6.2455 M          | 9.37 kb  | 1.89 kb |
    | 10    | 3          | 3        | 9.2320 M          | 12.40 kb | 0.73 kb |
  </Tab>
</Tabs>

## Shopify Functions Fixed Resource Limits

These limits are hard-coded by Shopify and apply to every function execution, regardless of cart size or discount complexity.

| Resource               | Limit            |
| ---------------------- | ---------------- |
| Compiled binary size   | 256 kB           |
| Runtime linear memory  | 10,000 kB        |
| Runtime stack memory   | 512 kB           |
| Logs written to STDERR | 1 kB (truncated) |

## Shopify Functions Dynamic Resource Limits

These limits govern how much compute work a function can perform during a single execution. They apply to carts with up to 200 line items.

| Resource                    | Limit (up to 200 line items) |
| --------------------------- | ---------------------------- |
| Execution instruction count | 11 million instructions      |
| Function input              | 64 kB                        |
| Function output             | 20 kB                        |

<Info>
  For carts with more than 200 line items, the dynamic resource limits above scale proportionally as the number of cart lines increases.
</Info>
