Apply discount together with free shipping

Alexander_dev
New Member
2 0 1

Hello to all.
For 'Shopify plus' stores you can use the free 'script editor' app and this setup guide (Change in shipping cost depending on discount code):
https://help.shopify.com/en/manual/checkout-settings/script-editor/examples/shipping-scripts#discoun...

JessLeon
New Member
2 0 1

Thanks for this update! 

Just to be clear does that meant that the only way to do this is to spend 2000USD per month and then manually edit script. 

Can someone from the team reach out. 

This price point is a giant barrier to entry for a simple ficntion/ 

 

I would like to 

Free shipping over $60 spend. 

Plus allow customers to use a discount code. 

This seems simple? 

What am I missing? 

 

 

Alexander_dev
New Member
2 0 1

I slightly changed the code from the guide, for the sake of simplicity. Checked, works.
We are planning to launch the action in the near future.
But yes, alas, this is only for shops of the "Shopify Plus" plan, unfortunately I cannot suggest another variant at the moment.
I'll just leave it here, hopefully someone will come in handy.

 

CONDITIONS_FOR_DISCOUNT = [
  {
    codes: ['SOMECODE', 'OTHERCODE'],
    d_type: :percent, # :percent/:money
    d_value: 100,
    d_message: 'Free shipping'
  }
]

CONDITIONS_FOR_DISCOUNT.each do |condition|
  next unless Input.cart.discount_code && condition[:codes].include?(Input.cart.discount_code.code.upcase.strip)
  
  Input.shipping_rates.each do |shipping_rate|
    discount_amount = if condition[:d_type] == :percent
      condition[:d_value] * 0.01 * shipping_rate.price
    else
      Money.new(cents: 100) * condition[:d_value]
    end
    shipping_rate.apply_discount(discount_amount, message: condition[:d_message])
  end
end

Output.shipping_rates = Input.shipping_rates

 

 ** script type 'Shipping'

0 Likes
Andrej_pryma
Tourist
8 0 3

So is there a way to combine percentage discount and free shipping?

0 Likes
anchortank
New Member
1 0 1

Please add us to the list as well.  We desperately need this feature and do not believe we should have to pay extra for this feature.  Thanks. 

thomasf8898
New Member
1 0 0

Hello, is there an update on this feature? I would like to know. Thank you!

0 Likes
Patricia_Roudne
New Member
1 0 0

Can I add my vote to include this too. Not with code but with a simple "include shipping as part of discount" option. Surely can't be that difficult?

0 Likes
TomOL
New Member
3 0 0

Hi -

Could someone please add the same functionality to my store so I can provide a discount and free shipping?  This would be greatly appreciated!

Thanks,

Tom

0 Likes
adrianthedev
New Member
2 0 0

+1 from us too.

0 Likes