- DarkLight
Implementing Free Shipping for VIP Tiers on Shopify Plus
- DarkLight
Offer free shipping to shoppers based on their VIP tier status. Free shipping is a great way to incentivize users to engage with your Loyalty program. This article will show how to implement free shipping on Shopify Plus.
Before you start
If you don’t have the Shopify Script Editor App, download it on the Shopify app store here.
Accessing your shipping rate names
- In your Shopify store go to Settings > Shipping and Delivery.
- Click Manage Rates.
- Copy the Rate name, i.e. “Expedited USA” or “DHL Express (Discounted rates from Shopify Shipping)”. You need to copy the Rate name EXACTLY as it appears in this field.
Creating a new shipping script
- Click Apps > Script Editor
If you are creating a new script, do the following:
- Click Create script.
- Click Shipping rates.
- Select Modify shipping rate price.
- Click Create script.
Example of what you will see after clicking Create script: - Select “Code” (not Input).
Embedding the code in your Script Editor
The next step is to paste the Yotpo shipping code into your shipping script. Below are three examples of code, choose one based on what kind of shipping discounts you want to offer.
If you want a percentage discount on shipping:
Below is an example script you can use if you want to offer a percentage discount on shipping for one VIP tier.
- Replace “swell_tier_gold” with your VIP tier name. The name will always begin with “swell_tier_” and then your tier name, for example, swell_tier_super gold tier
- Replace “shipping_rate_name” with the Rate name you want to discount. The names should match exactly how they appear on your shipping settings page.
- After “DISCOUNT_RATE” Enter the percentage of discount to offer on the above Rate. This should be a number between 0.01-0.99.
For example, 0.25 means you’re offering a 25% discount on shipping. In this example, if a shopper was a gold member and the shipping method cost $16, this would discount $4 off the shipping price.
Example script for a percentage discount on shipping
Additional instructions for adding to an existing shipping script
You only need to paste lines 4-21 if you are adding the Yotpo code to an existing shipping script. Paste it after your other code, inside your existing loop.
This means inserting the Yotpo code just before the last line which usually looks like this:
Output.shipping_rates = Input.shipping_rates.
Input.shipping_rates.each do |shipping_rate|
next unless shipping_rate.source == "shopify"
standard_shipping_flag = false
YOTPO_TIER = "swell_tier_gold"
SHIPPING_NAME = "shipping_rate_name"
DISCOUNT_RATE = 0.25
customer = Input.cart.customer
if customer
if (customer.tags.include?(YOTPO_TIER))
standard_shipping_flag = true
end
end
if shipping_rate.name == SHIPPING_NAME && standard_shipping_flag
shipping_rate.apply_discount(shipping_rate.price * DISCOUNT_RATE, message: "Discounted Shipping")
end
end
Output.shipping_rates = Input.shipping_rates
If you want to offer free shipping
Below is an example script you can use if you want to offer free shipping to two different VIP Tiers.
- Replace “swell_tier_gold”/”swell_tier_super gold” with your VIP Tier names. The name will always begin with “swell_tier_” and then your tier name, for example, swell_tier_super gold tier
- Replace “shipping_rate_name” with the Rate name you want to offer for free. The name should match exactly how it appears on your shipping settings page.
Example script for free shipping
Additional instructions for adding to an existing shipping script
You only need to paste lines 4-21 if you are adding the Yotpo code to an existing shipping script. Paste it after your other code, inside your existing loop.
This means inserting the Yotpo code just before the last line which usually looks like this:
Output.shipping_rates = Input.shipping_rates.
Input.shipping_rates.each do |shipping_rate|
next unless shipping_rate.source == "shopify"
standard_shipping_flag = false
YOTPO_TIER_1 = "swell_tier_gold"
YOTPO_TIER_2 = "swell_tier_super gold"
SHIPPING_NAME = "shipping_rate_name"
customer = Input.cart.customer
if customer
if (customer.tags.include?(YOTPO_TIER_1) or customer.tags.include?(YOTPO_TIER_2))
standard_shipping_flag = true
end
end
if shipping_rate.name == SHIPPING_NAME && standard_shipping_flag
shipping_rate.apply_discount(shipping_rate.price * 1, message: "Free Shipping")
end
end
Output.shipping_rates = Input.shipping_rates
If you want to free shipping for multiple shipping methods
Below is an example script you can use if you want to offer free shipping to two different VIP Tiers, with a discount on two different shipping methods.
- Replace “swell_tier_gold”/”swell_tier_super gold” with your VIP Tier names. The names should match exactly your Shopify Customer tags belonging to each tier. Learn more about creating and using tags in Shopify.
- Replace “shipping_rate_name” with the different Rate names you want to offer for free. The names should match exactly how they appear on your shipping settings page.
Example script for free shipping with two shipping methods
Additional instructions for adding to an existing shipping script
Only paste lines 4-21 if you are adding the Yotpo code to an existing shipping script. Paste it after your other code, inside your existing loop.
This means inserting the Yotpo code just before the last line which usually looks like this:
Output.shipping_rates = Input.shipping_rates.
Input.shipping_rates.each do |shipping_rate|
next unless shipping_rate.source == "shopify"
standard_shipping_flag = false
priority_shipping_flag = false
YOTPO_TIER_1 = "swell_tier_gold"
YOTPO_TIER_2 = "swell_tier_super gold"
STANDARD_SHIPPING_NAME = "shipping_rate_name"
PRIORITY_SHIPPING_NAME = "shipping_rate_name"
customer = Input.cart.customer
if customer
if (customer.tags.include?(YOTPO_TIER_1))
standard_shipping_flag = true
end
if (customer.tags.include?(YOTPO_TIER_2))
priority_shipping_flag = true
end
end
if shipping_rate.name == STANDARD_SHIPPING_NAME && standard_shipping_flag
shipping_rate.apply_discount(shipping_rate.price * 1, message: "Free Shipping")
end
if shipping_rate.name == PRIORITY_SHIPPING_NAME && priority_shipping_flag
shipping_rate.apply_discount(shipping_rate.price * 1, message: "Free Shipping")
end
end
Output.shipping_rates = Input.shipping_rates
Next steps
Make sure that you are telling your customers about your new free shipping perks!
If you have not already done so, update the text in your VIP Tiers Program Settings.