Ranked by price step in Regios Discounts: most expensive item full price, cheaper item free

The request: “If the customer buys 2 eligible items, make only the cheaper item free. If they buy 3, make the cheapest free, leave the most expensive at full price, and give 30% off the one in between.” It continued up to 6 items, with BOGO pairs repeating and a 30% discount on any odd item left over.

The logic below is the real discount our AI Discount Generator built and the merchant saved. Only the collection name has been replaced.

Why native Shopify discounts can’t do this

Shopify’s built-in Buy X Get Y can make one item free, but:

  • You can’t set a different discount per rank. There’s no way to say “cheapest free, next one 30% off, most expensive full price.”
  • The rules can’t change with cart size. One item, two items, and three items each need different treatment here.
  • You can’t control which end of the price range gets discounted beyond what Buy X Get Y does for you.

How the logic works

The discount uses ranked values: rank 1 is the cheapest eligible unit, rank 2 is the next cheapest, and so on. It first checks the item is in the eligible collection, then picks a branch by exact quantity:

1 item:  30% off
2 items: cheapest free, other full price
3 items: cheapest free, middle 30% off, most expensive full price
4 items: 2 cheapest free (BOGO twice)
5 items: 2 cheapest free, next 30% off, rest full price
6 items: 3 cheapest free (BOGO three times)

Build it with the AI Discount Generator

The fastest way. On the Regios Discounts home page, click Create discount and paste this prompt into the AI box, swapping in your own collection, product, and brand names:

Automatic discount for products in the Promo collection. 1 item: 30% off. 2 items: the cheaper one free, the other full price. 3 items: cheapest free, most expensive full price, the middle one 30% off. 4 items: buy one get one free twice. 5 items: BOGO twice plus 30% off the remaining item. 6 items: BOGO three times. Pick the free items by price.

We ran this exact prompt through the generator, and it builds the same logic as the JSON below. The generator also set the sort order setting for you. Review the steps it creates, link your own products or collections, and save.

Build it from scratch in the app

Step 1. Install Regios Discounts and open it. On the home page, click Create discount.

Step 2. Under Prefer not to use AI?, click Start from scratch.

Step 3. Choose Amount off product.

Step 4. Under How will customers get this discount?, choose Automatically. Give it a title, such as “Promo ranked by price”.

Step 5. Scroll to Discount steps and click Review discount steps. In the dialog, pick Start from scratch and click Next. You’ll see a Discount type box with a Then button.

Step 6. Click Then, choose Check if, and add a Collection criteria for your promo collection. Save it.

Step 7. On that check, click Then and choose Check if again. Add the Quantity criteria twice: once as Minimum purchase requirements with Minimum quantity of items set to 2, and once as Maximum purchase requirements with Maximum quantity of items set to 2. Together they mean exactly 2 items.

Step 8. On the quantity check, click Then, choose Apply discount, and set Discount type to Ranked by price. Leave Most expensive item on No discount and set 2nd most expensive to Percentage off at 100. That makes the cheaper item free.

Step 9. Click Otherwise on the quantity check and repeat steps 7 and 8 for each other cart size. For 3 items: most expensive No discount, 2nd 30%, 3rd 100%. Use Add next item to add ranks. Do the same for 1, 4, 5, and 6 items.

Step 10. Click Done. Under Advanced options, keep What order to apply discounts to products in on Discount highest priced products first. The rank labels follow this setting, so “Most expensive item” really is the most expensive one.

Step 11. Click Save.

Or import the logic

Prefer to skip the clicking? Create the discount as in steps 1 to 4 above, then click Logic at the top of the discount form, choose Import, and use the JSON below. The JSON import guide walks through each screen. Link eligible-collection to your collection.

Important for the import: this JSON ranks from the cheapest item up, so set What order to apply discounts to products in to Discount lowest priced products first. That setting isn’t part of the JSON.

Install now

Ready-to-import discount logic

Copy the JSON below into Regios Discounts using the import flow, or download this file. Step-by-step: how to import discounts from JSON files (home screen, Logic > Import, choosing discount type, linking missing resources, and saving).

Want to describe what you need in plain language instead? Our AI Discount Generator covers prompts, iterating on results, linking products/collections when the app asks, and using or exporting the logic.

{
  "id": "<root>",
  "type": "ROOT",
  "entryPoint": {
    "id": "check-collection",
    "then": {
      "id": "check-qty-6",
      "then": {
        "id": "apply-qty-6",
        "type": "APPLY_DISCOUNT",
        "title": "Buy One Get One Free three times",
        "value": {
          "rest": null,
          "type": "RANKED",
          "ranks": [
            {
              "discount": {
                "type": "PERCENTAGE",
                "percentage": "100"
              }
            },
            {
              "discount": {
                "type": "PERCENTAGE",
                "percentage": "100"
              }
            },
            {
              "discount": {
                "type": "PERCENTAGE",
                "percentage": "100"
              }
            },
            {
              "discount": null
            },
            {
              "discount": null
            },
            {
              "discount": null
            }
          ]
        }
      },
      "type": "CHECK_IF",
      "matchType": "AND",
      "otherwise": {
        "id": "check-qty-5",
        "then": {
          "id": "apply-qty-5",
          "type": "APPLY_DISCOUNT",
          "title": "BOGO twice plus 30% off remaining item",
          "value": {
            "rest": null,
            "type": "RANKED",
            "ranks": [
              {
                "discount": {
                  "type": "PERCENTAGE",
                  "percentage": "100"
                }
              },
              {
                "discount": {
                  "type": "PERCENTAGE",
                  "percentage": "100"
                }
              },
              {
                "discount": {
                  "type": "PERCENTAGE",
                  "percentage": "30"
                }
              },
              {
                "discount": null
              },
              {
                "discount": null
              }
            ]
          }
        },
        "type": "CHECK_IF",
        "matchType": "AND",
        "otherwise": {
          "id": "check-qty-4",
          "then": {
            "id": "apply-qty-4",
            "type": "APPLY_DISCOUNT",
            "title": "Buy One Get One Free twice",
            "value": {
              "rest": null,
              "type": "RANKED",
              "ranks": [
                {
                  "discount": {
                    "type": "PERCENTAGE",
                    "percentage": "100"
                  }
                },
                {
                  "discount": {
                    "type": "PERCENTAGE",
                    "percentage": "100"
                  }
                },
                {
                  "discount": null
                },
                {
                  "discount": null
                }
              ]
            }
          },
          "type": "CHECK_IF",
          "matchType": "AND",
          "otherwise": {
            "id": "check-qty-3",
            "then": {
              "id": "apply-qty-3",
              "type": "APPLY_DISCOUNT",
              "title": "Cheapest free and middle item 30% off",
              "value": {
                "rest": null,
                "type": "RANKED",
                "ranks": [
                  {
                    "discount": {
                      "type": "PERCENTAGE",
                      "percentage": "100"
                    }
                  },
                  {
                    "discount": {
                      "type": "PERCENTAGE",
                      "percentage": "30"
                    }
                  },
                  {
                    "discount": null
                  }
                ]
              }
            },
            "type": "CHECK_IF",
            "matchType": "AND",
            "otherwise": {
              "id": "check-qty-2",
              "then": {
                "id": "apply-qty-2",
                "type": "APPLY_DISCOUNT",
                "title": "Cheaper item free",
                "value": {
                  "rest": null,
                  "type": "RANKED",
                  "ranks": [
                    {
                      "discount": {
                        "type": "PERCENTAGE",
                        "percentage": "100"
                      }
                    },
                    {
                      "discount": null
                    }
                  ]
                }
              },
              "type": "CHECK_IF",
              "matchType": "AND",
              "otherwise": {
                "id": "check-qty-1",
                "then": {
                  "id": "apply-qty-1",
                  "type": "APPLY_DISCOUNT",
                  "title": "30% off one eligible item",
                  "value": {
                    "rest": null,
                    "type": "RANKED",
                    "ranks": [
                      {
                        "discount": {
                          "type": "PERCENTAGE",
                          "percentage": "30"
                        }
                      }
                    ]
                  }
                },
                "type": "CHECK_IF",
                "matchType": "AND",
                "otherwise": null,
                "conditions": [
                  {
                    "type": "PURCHASE_REQUIREMENTS",
                    "minOrMax": "MIN",
                    "requirements": {
                      "quantity": "1",
                      "subtotal": "0",
                      "appliesTo": "ELIGIBLE_LINE_ITEMS",
                      "requirementType": "QUANTITY",
                      "disableCurrencyConversion": false
                    }
                  },
                  {
                    "type": "PURCHASE_REQUIREMENTS",
                    "minOrMax": "MAX",
                    "requirements": {
                      "quantity": "1",
                      "subtotal": "0",
                      "appliesTo": "ELIGIBLE_LINE_ITEMS",
                      "requirementType": "QUANTITY",
                      "disableCurrencyConversion": false
                    }
                  }
                ]
              },
              "conditions": [
                {
                  "type": "PURCHASE_REQUIREMENTS",
                  "minOrMax": "MIN",
                  "requirements": {
                    "quantity": "2",
                    "subtotal": "0",
                    "appliesTo": "ELIGIBLE_LINE_ITEMS",
                    "requirementType": "QUANTITY",
                    "disableCurrencyConversion": false
                  }
                },
                {
                  "type": "PURCHASE_REQUIREMENTS",
                  "minOrMax": "MAX",
                  "requirements": {
                    "quantity": "2",
                    "subtotal": "0",
                    "appliesTo": "ELIGIBLE_LINE_ITEMS",
                    "requirementType": "QUANTITY",
                    "disableCurrencyConversion": false
                  }
                }
              ]
            },
            "conditions": [
              {
                "type": "PURCHASE_REQUIREMENTS",
                "minOrMax": "MIN",
                "requirements": {
                  "quantity": "3",
                  "subtotal": "0",
                  "appliesTo": "ELIGIBLE_LINE_ITEMS",
                  "requirementType": "QUANTITY",
                  "disableCurrencyConversion": false
                }
              },
              {
                "type": "PURCHASE_REQUIREMENTS",
                "minOrMax": "MAX",
                "requirements": {
                  "quantity": "3",
                  "subtotal": "0",
                  "appliesTo": "ELIGIBLE_LINE_ITEMS",
                  "requirementType": "QUANTITY",
                  "disableCurrencyConversion": false
                }
              }
            ]
          },
          "conditions": [
            {
              "type": "PURCHASE_REQUIREMENTS",
              "minOrMax": "MIN",
              "requirements": {
                "quantity": "4",
                "subtotal": "0",
                "appliesTo": "ELIGIBLE_LINE_ITEMS",
                "requirementType": "QUANTITY",
                "disableCurrencyConversion": false
              }
            },
            {
              "type": "PURCHASE_REQUIREMENTS",
              "minOrMax": "MAX",
              "requirements": {
                "quantity": "4",
                "subtotal": "0",
                "appliesTo": "ELIGIBLE_LINE_ITEMS",
                "requirementType": "QUANTITY",
                "disableCurrencyConversion": false
              }
            }
          ]
        },
        "conditions": [
          {
            "type": "PURCHASE_REQUIREMENTS",
            "minOrMax": "MIN",
            "requirements": {
              "quantity": "5",
              "subtotal": "0",
              "appliesTo": "ELIGIBLE_LINE_ITEMS",
              "requirementType": "QUANTITY",
              "disableCurrencyConversion": false
            }
          },
          {
            "type": "PURCHASE_REQUIREMENTS",
            "minOrMax": "MAX",
            "requirements": {
              "quantity": "5",
              "subtotal": "0",
              "appliesTo": "ELIGIBLE_LINE_ITEMS",
              "requirementType": "QUANTITY",
              "disableCurrencyConversion": false
            }
          }
        ]
      },
      "conditions": [
        {
          "type": "PURCHASE_REQUIREMENTS",
          "minOrMax": "MIN",
          "requirements": {
            "quantity": "6",
            "subtotal": "0",
            "appliesTo": "ELIGIBLE_LINE_ITEMS",
            "requirementType": "QUANTITY",
            "disableCurrencyConversion": false
          }
        },
        {
          "type": "PURCHASE_REQUIREMENTS",
          "minOrMax": "MAX",
          "requirements": {
            "quantity": "6",
            "subtotal": "0",
            "appliesTo": "ELIGIBLE_LINE_ITEMS",
            "requirementType": "QUANTITY",
            "disableCurrencyConversion": false
          }
        }
      ]
    },
    "type": "CHECK_IF",
    "matchType": "AND",
    "otherwise": null,
    "conditions": [
      {
        "type": "PRODUCT_ELIGIBILITY",
        "eligibility": {
          "type": "SPECIFIC_COLLECTIONS",
          "asListOfIds": "eligible-collection",
          "selectedCollections": []
        },
        "includeOrExclude": "INCLUDE"
      }
    ]
  }
}

Frequently asked questions

How does the discount know which item is cheapest?

The discount’s What order to apply discounts to products in setting is Discount lowest priced products first. The first rank always lands on the cheapest unit. That setting isn’t part of the JSON, so set it after importing.

Can I flip it so the most expensive item gets the discount?

Yes. Choose Discount highest priced products first instead. Rank 1 then lands on the most expensive unit, which is how “most expensive item 50% off” offers work.

What happens above 6 items?

In this version, nothing. The merchant only needed 1 to 6 items, so each quantity has its own branch. Add more branches, or use a repeating rule, if you need larger carts.

Is the price rank based on the sale price or compare-at price?

The sale price, before other product discounts apply.