Created
February 15, 2017 15:11
-
-
Save dylanjhunt/de4d66e145640d5ccee136fdf38da1ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
min_discount_order_amount = Money.new(cents:100) * 50 | |
total = Input.cart.subtotal_price_was | |
discount = if total > min_discount_order_amount | |
1 | |
else | |
0 | |
end | |
message = "Free shipping if order is over $50" | |
Input.shipping_rates.each do |shipping_rate| | |
next unless shipping_rate.source == "shopify" | |
shipping_rate.apply_discount(shipping_rate.price * discount, message: message) | |
end | |
Output.shipping_rates = Input.shipping_rates |
You beautiful man.
Hi guys , someone can you help me to add this script in my shopify store ?
@Fr4nk19 You need Shopify Plus to use scripts
This was amazing thank you!
Now, do you know if there is a way to incorporate different cart amount thresholds? A merchant has different shipping zones with different cart amounts before free shipping kicks in, and this would be SWELL for them if we could implement that somehow.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think I love you for this.