3 minute read
Conditional Shipping Rules with Shopify Plus Scripts
As an online seller using Shopify Plus, you may already know the importance of an effective shipping strategy. After all, shipping can make or break a customer’s experience with your company. To ensure your customers receive their orders on time and cost-effectively, it’s important to establish shipping rules that are tailored to your business.
This is where Shopify Plus scripts come into play. Shopify Plus Scripts enable sellers to create customizations and automation for their online stores. A popular use of scripts is to create conditional sending rules. These rules allow sellers to offer free shipping to specific customers or to set shipping costs based on factors such as order value, location, product weight, or quantity.
So how do you use Shopify Plus scripts to create conditional shipping rules? Let’s dive in.
Step 1: Enable scripts in your Shopify Plus store: The first thing you need to do is enable scripts in your Shopify Plus store. To do this, go to your Shopify dashboard and click “Online Store”. Then click “Topics” and then click the “Actions” drop-down menu next to the current topic. Select “Edit Code” and go to the “Cart” folder. Click the cart.liquid file and select Enable Scripts in the Theme Settings section.
Step 2: Create a new script: Once scripts are enabled, you can create a new script. Click the Scripts tab, and then click Create Script. Give your script a name and select “Send” as the script type. You can then start writing the script using Shopify’s scripting language called Liquid.
Step 3: Set Conditions for Shipping Rules: Liquid allows you to set conditions for shipping rules. For example, if you want to offer free shipping on orders over $100, you can use the cart.total_price variable to check the total value of a customer’s order and set the condition accordingly. Similarly, you can use variables like shipping_address.province to set location-based shipping rules or line_item.title to set rules based on specific products.
Step 4: Test and save your script: Once you have written your script and established the required conditions, you can test it by placing a test order and verifying that shipping costs are calculated correctly. If everything looks good, click Save to apply the script to your store.