Discount if the user adds 1, 2, or 3 quantities

Topic summary

Goal: apply a 50% discount only to the first 1–3 units of a specific product; the 4th unit (and beyond) should be full price.

Proposed solutions:

  • Custom code in theme: a developer offered to provide a code-based solution after reviewing the store/theme. The requester asked for code, but none was posted.
  • Apps:
    • Secomapp Gifts and Bundles: suggested, but support said it doesn’t currently support this exact feature.
    • BundleJoy: use “packs” (e.g., a 3-pack) so only the pack is discounted; increasing quantity adds full‑price units. Demo link shared.
    • Slice n’ Save: configure a BOGO (buy-one-get-one) style rule to cap the discounted quantity; guide linked.
    • Regios Discounts: set include/exclude for the product and cap the maximum discounted quantity at 3; screenshots show a 4th item is not discounted.
    • Discount Bot: set a maximum discount quantity and target specific items; screenshots show excess items at full price; supports tiered/quantity breaks.

Status: No confirmed implementation or final decision. Apps that support a “maximum discounted quantity” appear to match the requirement; custom-code solution remains unspecified. Screenshots are central to understanding the app configurations.

Summarized with AI on December 12. AI used: gpt-5.

Thanks @TheScriptFlow
Please give me solution with code also