Shopify Script: Free Product, 1 Size Larger Than The Current Order

Hi everyone,

I need help in writing a Shopify script. The store I’m writing this script for is selling women’s underwear. The script should give 1 Free Bra that’s larger than the current one in the cart.

The bra sizes are from Small to Extra Large.

Examples:

  • Customer orders 4 Large Bras then automatically, they will get 1 Free XL Bra upon checkout.
  • 1 Small Bra will get 1 Free Medium Bra
  • 1 Medium Bra will get 1 Free Large Bra
  • 1 Large Bra will get 1 Free Extra Large Bra

I’m following this guide from JayAnetty as the base but I’m having a difficult time completing it as it’s a different scenario.