The 4 Shopify Plus Scripts You Need to Boost Conversions

It happens too frequently.

Shoppers visit your site, do some window-shopping, maybe even fill their cart, and then disappear – sometimes never to return.

In fact, nearly 70 percent of the shoppers who visit a site will leave without being converted into buyers.

What goes wrong?

There are many possibilities, but two things stand out as deal breakers for many shoppers.

For one, expensive shipping rates.

And two, a lack of trust in your brand or product.

Fortunately, Shopify Plus Scripts can help — and are especially exciting if you are looking to boost conversions and impress your customers with dynamic offers that reduce shipping costs or add an incentive (discount, free gift, etc.) that helps fight a lack of trust.

Shopify scripts are small pieces of code that allow you to easily create personalized experiences when shoppers visit your online store.

One of the biggest benefits of Shopify Plus Scripts is the versatility offered.

When you use scripts, you can custom build enhancements and rules for your store.

Here are a few shopify plus scripts you should implement today:

1 – Free Shipping for VIP Members

In the U.S., 54 percent of digital shoppers abandon shopping carts due to the high cost of shipping.

This means you could be losing more than half your business if you pass on shipping costs to your shoppers!

With scripts, you can offer free shipping to repeat or “VIP” customers who share their email address, join your online community, sign up for your newsletter, etc.

And this can be especially valuable since repeat customers are the lowest hanging fruit.

Consider this: 40% of online revenue comes from returning or repeat purchasers, even though these repeat customers only represent 8% of all visitors.

# Define a list of shipping service names that are eligible for free shipping for VIPs.
ELIGIBLE_SERVICES = ['Standard Ground Shipping']
# Define the tag that identifies VIP customers.
VIP_CUSTOMER_TAG = 'VIP'
# If the customer is a VIP, give them free shipping on the defined services.
if !Input.cart.customer.nil? and Input.cart.customer.tags.include?(VIP_CUSTOMER_TAG)
Input.shipping_rates.each do |shipping_rate|
if ELIGIBLE_SERVICES.include?(shipping_rate.name)
shipping_rate.apply_discount(shipping_rate.price, message: "Free shipping for VIP customers!")
end
end
end
# Export the rates.
Output.shipping_rates = Input.shipping_rates


Bottom line: Offering free shipping can be the nudge a returning shopper needs to keep buying from you and not your competitor. (It’s also valuable when it comes to clearing older inventory or launching a new product you want people to try out).

2 – Buy One Get One Free

Buy One Get One Free (BOGO) deals, in reality, are most often used to clear out old or unwanted inventory or quickly generate some sales.

But once lured in by a BOGO offer, a lot of shoppers will end up buying other, full-price items from you.

And they’ll feel good about shopping with you because they found a bargain.

# Buy One, Get One Free Script
# The basis of this script provided by the Script Editor itself as a "default" script option.
# Adjusting these values lets you tweak the scope of the discount, eg:
# PAID_ITEM_COUNT = 1, DISCOUNTED_ITEM_COUNT = 1 -> Buy One, Get One
# PAID_ITEM_COUNT = 3, DISCOUNTED_ITEM_COUNT = 2 -> Buy Three, Get Two
PAID_ITEM_COUNT = 1
DISCOUNTED_ITEM_COUNT = 1
# Specify the IDs of the products you'd like to be eligible for this promotion.
ELIGIBLE_PRODUCT_IDS = [9307791812, 9307791940]
# Returns the integer amount of items that must be discounted next
# given the amount of items seen
#
def discounted_items_to_find(total_items_seen, discounted_items_seen)
Integer(total_items_seen / (PAID_ITEM_COUNT + DISCOUNTED_ITEM_COUNT) * DISCOUNTED_ITEM_COUNT) - discounted_items_seen
end
# Partitions the items and returns the items that are to be discounted.
#
# Arguments
# ---------
#
# * cart
# The cart to which split items will be added (typically Input.cart).
#
# * line_items
# The selected items that are applicable for the campaign.
#
def partition(cart, line_items)
# Sort the items by price from high to low
sorted_items = line_items.sort_by{|line_item| line_item.variant.price}.reverse
# Create an array of items to return
discounted_items = []
# Keep counters of items seen and discounted, to avoid having to recalculate on each iteration
total_items_seen = 0
discounted_items_seen = 0
# Loop over all the items and find those to be discounted
sorted_items.each do |line_item|
total_items_seen += line_item.quantity
# After incrementing total_items_seen, see if any items must be discounted
count = discounted_items_to_find(total_items_seen, discounted_items_seen)
# If there are none, skip to the next item
next if count <= 0
if count >= line_item.quantity
# If the full item quantity must be discounted, add it to the items to return
# and increment the count of discounted items
discounted_items.push(line_item)
discounted_items_seen += line_item.quantity
else
# If only part of the item must be discounted, split the item
discounted_item = line_item.split(take: count)
# Insert the newly-created item in the cart, right after the original item
position = cart.line_items.find_index(line_item)
cart.line_items.insert(position + 1, discounted_item)
# Add it to the list of items to return
discounted_items.push(discounted_item)
discounted_items_seen += discounted_item.quantity
end
end
# Return the items to be discounted
discounted_items
end
eligible_items = Input.cart.line_items.select do |line_item|
product = line_item.variant.product
!product.gift_card? && ELIGIBLE_PRODUCT_IDS.include?(product.id)
end
discounted_line_items = partition(Input.cart, eligible_items)
discounted_line_items.each do |line_item|
line_item.change_line_price(Money.zero, message: "Buy one, get one free!")
end
Output.cart = Input.cart
view raw bogo.rb hosted with ❤ by GitHub

Bottom line: Shoppers love “free” and a BOGO deal can create a lot of interest and excitement. Scripts makes it easy for you to set up promotions with simple or complex logic (BOGO deals, buy two get one free, buy four get 20% off, etc.)

3 – Free Gift with Purchase

Did I mention people love free stuff?

Free gifts are a fabulous lure for shoppers.

A few years ago I read about experiments conducted for a Journal of Marketing study.

Participants had a choice – either get 33% more coffee for free or get 33% off the regular price of coffee.

More people picked the free extra coffee, even though the discount is a better deal.

Why? Because people generally perceive “free” as better than a discount (many of us are also lousy at math – but that’s another story).

With scripts, you can create customized shopping thresholds or offer free gifts when shoppers add certain items to their cart.

For example, in the first case, if you sell organic dog food you could offer a free bag of treats when shoppers spend $50.

Or, in the second case, offer a free dog toy when someone buys a certain type of dog food.

Shopify Plus Scripts Maximize Conversions – Free Gift with Purchase

Above: Emazing Lights offered a free bandana when customers spent a certain amount.

# Define the ID of the free product.
FREE_GIFT_PRODUCT_ID = 9307791812
# Check that we have at least two items in the cart (so that there's a "purchase").
if Input.cart.line_items.size > 1
Input.cart.line_items.each do |line_item|
# If the free gift is found, set its price to zero.
if line_item.variant.product.id == FREE_GIFT_PRODUCT_ID
if line_item.quantity > 1
line_item = line_item.split(take: 1)
Input.cart.line_items << line_item
end
line_item.change_line_price(Money.zero, message: "Free gift with purchase!")
end
end
end
# Export the cart.
Output.cart = Input.cart

Bottom line: Free gift deals can be especially useful when you are selling a product that is widely available and need to differentiate yourself from the competition. In this use, you don’t affect your profit margin on the main item, and can potentially clear your inventory of an item that isn’t selling (or selling anymore) while making your customer feel good about buying from you.



4 – Tiered Discounts

This is really the gamification of shopping.

Today’s online shoppers are savvy and know how to find the best deals.

They also love being rewarded for buying more.

Tiered discounts can add excitement and give the customer the feeling they are, in a way, competing not just to save more, but essentially “win” as a shopper.

Tiered discounts work in large part because you are highlighting the savings to your customers as they add more items to their carts and when they are close to reaching even more savings.

Think of those pop-ups that say, “You are only $4.54 away from saving 20%!” or “Add one more of this item and save $2.00!”

With scripts, your site can change prices and give discounts based on what items are added to a shopper’s cart.

The scripts run each time that an item is added, removed or changed in a cart so the shopper can immediately see the impact of their choice.

# Define spending thresholds, from lowest spend to highest spend.
SPENDING_THRESHOLDS = [
{
spend: 3000, # spend amount (in cents)
discount: 10 # percentage discount
},
{
spend: 5000,
discount: 15
},
{
spend: 10000,
discount: 20
}
]
# Find any applicable spending threshold.
eligible_threshold = nil
SPENDING_THRESHOLDS.each do |threshold|
if Input.cart.subtotal_price_was.cents >= threshold[:spend]
eligible_threshold = threshold
end
end
# Apply threshold.
if !eligible_threshold.nil?
Input.cart.line_items.each do |line_item|
line_item.change_line_price(line_item.line_price * (1.0 - (eligible_threshold[:discount] / 100.0)), message: "#{eligible_threshold[:discount]}% off for purchases over $#{eligible_threshold[:spend] / 100}!")
end
end
Output.cart = Input.cart

Bottom line: It’s no secret discounts are a draw. Seventy-one percent of U.S. shoppers say discounts and coupons influence their shopping behavior. Scripts lets you easily add these to your site, as well as manage them as needed.



Final Thoughts – Shopify Plus Scripts to Boost Conversions

Online customers can easily shop around for the best deals.

As a result, you need to set yourself apart and a great way to do so is by offering discounts and free items.

Shopify Plus Scripts make this simple to do and give you the ability to optimize these offers in a variety of ways – whether for the short-term or long run.

Get real conversion rate winners in your inbox

Every Wednesday, we email you 1 proven strategy to boost conversion rates and site revenue. Based on real A/B test results from 8 and 9-figure brands.

We do the research, testing and analysis so you can stay ahead of the competition.

    Read by thousands of brands including: