Add Free Shipping Notifications to Shopify Cart
Published on Jul 26, 2024
In the competitive world of e-commerce, offering free shipping can be a powerful incentive for customers to complete their purchases. But how can you effectively communicate this offer to your shoppers? This guide will walk you through the process of adding a dynamic free shipping notification to your Shopify cart, helping you boost sales and improve customer satisfaction.
Understanding the Importance of Free Shipping Notifications
Why Free Shipping Matters
Free shipping is more than just a perk - it’s often a deciding factor for many online shoppers. By clearly communicating when customers are close to qualifying for free shipping, you can encourage them to add more items to their cart, increasing your average order value.
The Psychology Behind Cart Notifications
Notifications that inform customers how close they are to reaching a free shipping threshold tap into the psychological principle of goal gradient effect. This theory suggests that people are more motivated to complete a goal as they get closer to it. In the context of online shopping, this can translate to increased purchases.
Benefits for Your Shopify Store
Implementing free shipping notifications can lead to several benefits for your store:
- Increased average order value
- Reduced cart abandonment rates
- Improved customer experience and satisfaction
Adding Free Shipping Notifications to Your Shopify Cart
Accessing Your Theme Files
To add the free shipping notification, you’ll need to edit your theme files. Here’s how to access them:
- Go to your Shopify admin panel
- Navigate to “Online Store” under Sales Channels
- Click on the three dots (…) next to the “Customize” button
- Select “Edit code”
Locating the Correct File
The next step is to find the right file to edit. In most cases, this will be the main-cart-items.liquid
file, located under the “Sections” folder. If you’re using a different theme, you may need to look for a similar file that controls the cart display.
Adding the Notification Code
Once you’ve located the correct file, you’ll need to add the following code:
{% assign shipping_value = 15000 %}
{% assign cart_total = cart.total_price %}
{% assign shipping_value_left = shipping_value | minus: cart_total %}
<p class="shipping-savings-message">
{% if shipping_value_left > 0 %}
<span class="free_shipping_notice">You are {{ shipping_value_left | money }} away from free shipping! <a href="/collections/all">Continue shopping</a> to add more products to your cart and receive free shipping for orders over $150.00 AU</span>
{% endif %}
</p>
<style>
.shipping-savings-message {
width: 100%;
display: flex;
justify-content: center;
}
.free_shipping_notice {
font-size: 1.2em;
font-weight: 600;
color: #ff0000;
line-height: 1.5em;
}
</style>
Insert this code above the line that reads:
<form action="{{ routes.cart_url }}" class="cart__contents critical-hidden" method="post" id="cart">
Customizing the Notification
The code provided sets the free shipping threshold at $150 AU. To adjust this, modify the shipping_value
variable. For example, to set it to $100, change {% assign shipping_value = 15000 %}
to {% assign shipping_value = 10000 %}
.
You can also customize the message text and styling to match your brand. Adjust the content within the tags and modify the CSS in the
section to change colors, fonts, and layout.
Advanced Customization Options
Currency-Based Thresholds
If your store serves multiple countries with different free shipping thresholds, you can use currency codes to set different values:
{% if currency.iso_code == 'USD' %}
{% assign shipping_value = 15000 %}
{% elsif currency.iso_code == 'AUD' %}
{% assign shipping_value = 20000 %}
{% elsif currency.iso_code == 'EUR' %}
{% assign shipping_value = 15000 %}
{% elsif currency.iso_code == 'GBP' %}
{% assign shipping_value = 16000 %}
{% endif %}
Dynamic Updates
To ensure the notification updates dynamically as customers add or remove items from their cart, you may need to implement some JavaScript. This would involve listening for cart update events and recalculating the remaining amount needed for free shipping.
Threshold-Based Messaging
You can create more nuanced messaging based on how close the customer is to the free shipping threshold:
{% assign shipping_value = 40000 %}
{% assign cart_total = cart.total_price %}
{% assign shipping_value_left = shipping_value | minus: cart_total %}
<p class="shipping-savings-message">
{% if shipping_value_left > 10000 %}
<span class="free_shipping_notice">Add {{ shipping_value_left | money }} more to your cart for free shipping!</span>
{% elsif shipping_value_left > 0 %}
<span class="free_shipping_notice">You're so close! Just {{ shipping_value_left | money }} away from free shipping!</span>
{% else %}
<span class="free_shipping_notice">Congratulations! You've unlocked free shipping!</span>
{% endif %}
</p>
Troubleshooting Common Issues
Notification Not Appearing
If you don’t see the notification after adding the code, double-check that you’ve inserted it in the correct location within the file. Also, ensure that your theme is using the file you’ve edited - some themes may use alternative cart templates.
Incorrect Calculations
If the amounts displayed are incorrect, verify that you’ve set the shipping_value
variable correctly. Remember that Shopify stores monetary values in cents, so $100 would be represented as 10000.
Styling Conflicts
If the notification doesn’t look right, it may be conflicting with existing styles in your theme. Try adjusting the CSS or adding !important
to your style rules to override conflicting styles.
By following this guide, you should now have a functional free shipping notification in your Shopify cart. Remember to test thoroughly across different devices and scenarios to ensure a smooth customer experience. With this feature in place, you’re well on your way to increasing your average order value and delighting your customers with the prospect of free shipping.
Take Our Quick Quiz:
Which primary product image do you think has the highest conversion rate?