While you're running quite some marketing campaigns to drive traffic to your store, you shouldn't be held back due to platform limitations and lack of customization options. Migrating to Shopify plus not only allows you to leverage a highly reputable platform to fulfill a significant volume of orders; its scalability makes expanding and customization a lot smoother.

Owing to the brand value created with the physical store and the deals and discounts, you're seeing a lot of visitors but no equivalent sales; in that case, your Shopify Plus checkout process plays a critical role. The Shopify Plus platform customization possibilities open up a whole new checkout experience, giving you the edge over your competition.

A custom-built commerce store not only looks more professional, but it's also essential in making your business stand out from a crowded market. 

One of the easiest ways to personalize, optimize and automate is with Shopify Scripts and the exclusive Shopify Script Editor. Although Shopify Scripts are just small pieces of code, available only with Shopify Plus, they can make a big difference to your store.

Shopify Scripts overview

The code snippets of Shopify Scripts not only help you run promotions with or without discount codes, but you can also automate the way discounts are applied and securely change the behavior of payment methods and shipping rates. On the same terms, by utilizing Shopify Script creator you are adding custom server-side logic to checkout. With Shopify Scripting language you can do the following:

  • Set up a payment method as the default
  • Hide checkout elements like the discount code box
  • Hide manual payment methods for non-eligible customers

Types of Shopify Scripts:

As said earlier, the power of Shopify Scripts and Shopify Script creator  goes beyond just applying discounts. You can customize and personalize your customer's shopping experiences in their carts and checkout with various Shopify Script types. The three main categories of Shopify Scripts are: Line item scripts, shipping scripts, and payment scripts.

Line item Shopify Scripts

Line item Shopify Scripts:

Based on the customer cart behavior, like adding, removing, or changing the products, these Shopify Scripts are run every time to customize the price of the line items in a cart or grant discounts.

Line item Shopify Scripts

Shipping Shopify Scripts:

As the name says, with the Shipping Shopify Scripts, you can customize the shipping field, like changing the shipping methods or granting discounts to specific locations, in your customer checkout process. These scripts run every time a customer visits the shipping options page at checkout.

Line item Shopify Scripts

Payment Shopify Scripts:

Get to customize the payment options, like rename, hide and reorder payment gateways with Shopify Payment Scripts. You can run these scripts every time a customer accesses the payment method page at checkout.

How are Shopify Scripts implemented?

Writing, editing, debugging, and publishing a script requires you to use Shopify's versatile Script Editor/Shopify Script creator to create personalized checkout experiences that can help you increase conversions. The Shopify scripting language used is Ruby for you to interface with the Shopify API. 

How are Shopify Scripts implemented?

Because Scripts run within Shopify's environment, you can create an impact on a fundamental level, meaning you can use Shopify Script creator to apply things like line item level discounts in the customer checkout without any sort of hackery that existing applications need to perform. Now that you've got an idea of what Scripts are at a high level let's see some Shopify Script examples with code. 

Extensive customizations with Shopify Scripts:

Allowing you to customize the checkout experience, Shopify Plus gives you access to a whole ecosystem of advanced Plus configurations. You can utilize the script configuration file and Shopify scripting language to define properties for your scripts. 

The script.json file includes script title, description, and configuration schema. And, just by entering values and options in the Shopify admin, you can customize your script as the values are passed in with the defined structure in the script configuration file. The file configuration of Shopify Script Creator lets you add, remove or reorder content, change the styling to your liking, improve the navigation and ensure the checkout page matches your branding. 

Apart from configuring schema for scripts, you can localize payment and shipping method names in your scripts. Localizing the scripts allows you to serve multiple languages and cultures.

Instead of hard-coding the translated text strings in the script, you can easily create locale files and enter the translation keys and values. So that when the Shopify scripting language runs at checkout, it reads the order's locale and offers the method names in the customer's preferred language.

The most popular and best Shopify Scripts examples to get started:

Following Shopify Scripts are some of the most popular types of discounts and customizations you can get started: 

  • Tag-based - Percentage or fixed discounts or a combination of both.  
  • Promotion scripts - Buy one get one (BOGO), Buy two get 10% off. 
  • Shipping scripts - Free Shipping on cart value, hide payment gateways
  • Offer dynamic pricing with volume-based price breaks.

Shopify Script examples to try with code:

Embedding an array of easy-to-apply discounts, promotions, and fulfillment options using Shopify Scripts not only optimizes and automates your ecommerce checkouts in creative ways. The Shopify Scripts, constructed using Shopify scripting language, helps you deliver a generous and memorable customer experience, reducing cart abandonment and lifting conversions. 

Many top-performing brands are using Shopify Scripts and Shopify Script Creator to optimize their conversion rates; below are the top - Line item scripts, payments scripts, and shipping scripts you can use year-round. 


You can visit  the Shopify Script Github repository for other Shopify line item scripts. Plus, you can allow only one line item script to run at a time. To run two or more line items scripts, you would be required to apply several conditions. For any Shopify Script support, connect with the HulkApps Shopify Script support team.

Buy one get one free (BOGO)

Category: Line Item Scripts

As known to be the popular technique to incentivize customers into buying more, use this BOGO script in Shopify Script Creator to urge first and second-time buyers to make the purchase. 

How does the Shopify Script work:

Input ELIGIBLE_PRODUCT_IDS you want to give for free, and your customers shall get to see only those products. Plus, you can use PAID_ITEM_COUNT and DISCOUNTED_ITEM_COUNT methods to maximize the AOV and sell earlier. 

# Buy One, Get One Free Script

# The basis of this script is provided by the Script Editor itself as a "default" script option.

# Adjusting these values lets you tweak the scope of the discount, eg:





# 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


# 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_seen += line_item.quantity


      # 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_seen += discounted_item.quantity



  # Return the items to be discounted



eligible_items = Input.cart.line_items.select do |line_item|

  product = line_item.variant.product

  !product.gift_card? && ELIGIBLE_PRODUCT_IDS.include?(product.id)


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!")


Output.cart = Input.cart

VIP membership discount

Category: Line Item Scripts

Get to reward only your loyal customers by offering a site-wide discount by using this script. Urge customers to make more sales to be a part of VIP membership or program. If you find any difficulty in implementing this script, avail our free shipping for customers with 'VIP' tag Shopify Script service. 

How does the Shopify Script work:

By default, the script will be executed with customers with a MEMBERSHIP tag, but if you want to place some conditions, also it is possible with DISCOUNT_AMOUNT and CUSTOMER_TAG methods. 

# Set to the percentage discount you'd like to apply store-wide.



if !Input.cart.customer.nil? and Input.cart.customer.tags.include?(CUSTOMER_TAG)

  # Apply the discount to every item in the cart.

  Input.cart.line_items.each do |line_item|

    next if line_item.variant.product.gift_card?

      line_item.change_line_price(line_item.line_price * (1.0 - (DISCOUNT_AMOUNT / 100.0)), message: "#{DISCOUNT_AMOUNT}% off store-wide!")



Output.cart = Input.cart

Free gift with purchase

Category: Line Item Scripts

Treat your customer for purchasing items from your store by offering free gifts. This Shopify Script Creator: Buy Any Item in Collection and Get a Free Gift is a wonderful and cost-effective script that helps you retain your customers effortlessly.

How does the Shopify Script work:

In the FREE_GIFT_PRODUCT_ID attribute, define the product id you want to give away as a gift and later apply the conditions and custom message to get this script running. 

# Define the ID of the free product.


# 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


      line_item.change_line_price(Money.zero, message: "Free gift with purchase!")




# Export the cart.

Output.cart = Input.cart

Auto-select default payment method

Category: Payment Scripts

Want to ease your customer experience in checkout by minimizing customer inputs? If yes, you can use Shopify Script Creator: Auto-select default payment method payment script and reduce the number of clicks a customer makes in the checkout, decreasing the churn rate. 

How does the Shopify Script work:

This Shopify Script will re-order the payment gateways options according to the order you prefer. Like, you can go push customers to go through Shopify Payments first? Or Paypal? Maybe Amazon Pay?. 

# Define the preferred order of gateways.

PREFERRED_GATEWAY_ORDER = ['Invoice', 'Shopify Payments']

# Sort gateways.

Output.payment_gateways = Input.payment_gateways.sort_by do |payment_gateway|

PREFERRED_GATEWAY_ORDER.index(payment_gateway.name) || 999


Provide invoice payment option for wholesale orders

Category: Payment Scripts

Avoid the labor-intensive and time-consuming B2B ecommerce process with Shopify Script Creator and this script. Utilizing this script can automate tedious work and focus on company growth. 

How does the Shopify Script work:

By utilizing INVOICE_GATEWAY_NAME and WHOLESALE_CUSTOMER_TAG methods, you can configure the payments methods and the wholesale customer for whom the option should be displayed. 


You can not use this script on the Shopify Plus Wholesale channel; you can get it just on the regular online storefront or expansion stores.

# Name of the invoice payment method.


# Tag that wholesale customers are expected to have.



# Filter out the invoice payment gateway if the customer is so tagged.

Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway|

case payment_gateway.name


Input.cart.customer.nil? || !Input.cart.customer.tags.include?(WHOLESALE_CUSTOMER_TAG)





Free shipping for certain products:

Category: Shipping scripts

This script is great if you offer free shipping only on certain products. The Shopify Script Creator: Free Shipping for New Customers Only on Specific Shipping Option will conditionally bring down the shipping rate to $0 and include a "Free Shipping!" message at checkout.

How does the Shopify Script work:

The shipping rate is discounted to $0 only when products in the cart include a certain tag, i.e., all products in the cart must include the relevant tag for free shipping to apply.

FREE_TAG = 'freeship'


if Input.cart.shipping_address.country_code == 'US' && Input.cart.line_items.any?{|item| item.variant.product.tags.include? FREE_TAG}

Input.shipping_rates.each do |shipping_rate|

next if shipping_rate.price == Money.zero

shipping_rate.apply_discount(shipping_rate.price, message: "Free Shipping!")





Output.shipping_rates = Input.shipping_rates

Offer Pickup For Customers By Shipping Location

Category: Shipping scripts

Whether the shipping is free or not, allowing your customer to pick up their products on their preferred date and time will certainly enhance better engagement. Well, in that case, this Shopify Script Creator: Offer in-store Pickup for specific location script could be just the thing. 

How does the Shopify Script work:

Define the postcodes that are eligible for the pickup by using the PICKUP_POSTCODE_PREFIXES variable, and customers within these postcodes are given the option to pick up in-store. 

# Define the name of the pick up shipping rate - this should be added manually in the Shopify Admin.



# Define a list of postcode prefixes that are allowed to pick up from the store.


  '100', '101', '102'



# Output filtered shipping rates.

Output.shipping_rates = Input.shipping_rates.delete_if do |shipping_rate|

  (shipping_rate.name == PICKUP_SHIPPING_RATE_NAME) && !PICKUP_POSTCODE_PREFIXES.any? { |prefix| Input.cart.shipping_address.zip.start_with?(prefix) }


Shopify Scripts and how it can help you?

Shopify Scripts and how it can help you?

Marketers use Shopify Scripts at customer shopping carts to incentivize customers and increase average order value with discounts. The customization options with Shopify Scripts come with a range of exclusive benefits that drive conversions, attract new customers, and retain old ones. Let's take a look at them in detail:

  • Offers a way to handle complex product bundles, specific discounts with minimum thresholds, and tiered pricing. 
  • It makes your checkout process more intuitive, pasting in a discount code or deciphering less automated bulk pricing.
  • Quickly achieve fluid automation of specific functionalities involved in marketing.


Optimizing your ecommerce checkout experience impacts the way conversions are achieved. And, with many brands offering the same, retention is the new acquisition. Advertising custom promotions and offering discounts at checkout with Shopify Scripts to customers will help you build your truly personal relationships at scale.

In fact, with Shopify Script - Buy one get one, Allbirds, a New Zealand sustainable shoe brand, allowed its customers to support the healthcare community while making a personal purchase for themselves. In another case, with an appropriate setup of checkout customization,  Chubbies, a lifestyle apparel brand, used the "Shopify Script Creator: Free Gift with Purchase" Shopify Script to increase conversions. 

Get Shopify Scripts

As we see, many top-performing brands are using Shopify Scripts to get creative and optimize their store checkout experience. Don't hold yourself back; connect with us if you need any support optimizing your checkout experience with Shopify Scripts for more conversions. Our team of experts works with you through every step to ensure Shopify Scripts are correctly embedded. We offer custom Shopify Scripting too. If you have any idea, say it out loud with our experts, and you can get started effortlessly.

Shopify Script FAQ’s

Shopify scripts are small pieces of code for you to offer custom discounts, shipping options, and payment methods. By utilizing these Scripts, you can optimize your store checkout experience.

Shopify scripts are written using the Shopify Scripts API, using the Ruby on Rails programming language. By using Shopify Editor and Shopify scripting language, you get to write, edit, manage and publish scripts effortlessly.

The Shopify Script Editor is a Shopify app built by Shopify to run dynamic promotions within your store. You can install the Shopify Script Editor within your Shopify Plus store via the app store here.

By localization of payment and shipping method names, you can make scripts available to serve multiple languages and cultures.

Utilize any one of the Line Item Shopify Scripts to change prices and grant discounts. To utilize multiple line item discounts, you need to add them as conditions. To quickly get your job done, you can connect with the HulkApps Shopify Script support team.

Yes, by using Payment Shopify scripts, you can rename, show, hide, or reorder payment gateways.