How to Use Conditional Shipping Functions

Last updated
19th April 2024
Read time
7 mins

Shipping options can make or break the checkout experience. With Shopify Functions, you can create sophisticated rules that dynamically adjust which shipping methods appear based on cart contents, customer details, and more. This guide will walk you through implementing conditional shipping functions for different types of stores.

Why Customize Shipping Options?

The default Shopify shipping experience presents all available options to every customer. However, there are many scenarios where you might want more control:

Function Types for Shipping Customization

Sway Functions Generator offers three primary shipping function types:

  1. Conditionally Hide Rates - Show/hide shipping options based on specific conditions
  2. Change Rate Names - Rename shipping options dynamically based on conditions
  3. Reorder Shipping Rates - Change the order of shipping options to prioritize certain methods

Implementation Examples by Store Type

For International Fashion Retailers (1000+ products)

Challenge: Need to hide expedited shipping options for heavy orders shipping to remote regions due to high costs and reliability issues.

Function: Conditionally Hide Rates
Configuration:
- If cart weight exceeds 5kg AND shipping destination is in [list of remote regions]
- Hide shipping options containing "Express" or "Overnight"
- Show message: "Express shipping unavailable for this order weight and destination"

Business Impact: Prevents customer disappointment when expensive shipping options fail to deliver as promised in remote regions. Reduces customer service inquiries and shipping-related returns.

For Luxury Home Goods Stores (500+ products)

Challenge: Need to require white-glove delivery service for high-value furniture to ensure proper handling.

Function: Conditionally Hide Rates
Configuration:
- If cart contains products from "Furniture" collection AND order value > $1,500
- Hide all shipping options EXCEPT "White Glove Delivery"
- Show message: "Premium delivery service required for furniture orders"

Business Impact: Ensures proper handling of high-value items, reduces damage during shipping, and enhances customer experience for significant purchases.

For Specialty Food Retailers (100-200 products)

Challenge: Need to restrict shipping options for perishable items during summer months to prevent spoilage.

Function: Conditionally Hide Rates
Configuration:
- If cart contains products with tag "Perishable" AND current month is between May-September
- Hide shipping options EXCEPT "Refrigerated Shipping" and "Next Day Air"
- Show message: "Temperature-controlled shipping required for perishable items"

Business Impact: Maintains product quality, reduces spoilage-related refunds, and improves customer satisfaction with perishable products.

For Global Beauty Brands (300+ products)

Challenge: Need to customize shipping option names based on destination country to reflect accurate delivery timeframes.

Function: Change Rate Names
Configuration:
- For US customers: Rename "Standard Shipping" to "Delivery in 2-3 business days"
- For International customers: Rename "Standard Shipping" to "Delivery in 7-14 business days"
- For EU customers: Add message about VAT inclusion in shipping options

Business Impact: Sets accurate delivery expectations, reducing customer service inquiries about shipping timeframes and increasing trust in international markets.

For Health & Wellness Subscription Services

Challenge: Need to prioritize eco-friendly shipping options for environmentally-conscious customers.

Function: Reorder Shipping Rates
Configuration:
- If customer has tag "Eco-conscious" OR cart contains products with tag "Sustainable"
- Move "Carbon-neutral Shipping" to the top of options list
- Show message: "We recommend carbon-neutral shipping for a greener planet"

Business Impact: Aligns shipping options with customer values, increases selection of eco-friendly options, and strengthens brand positioning with environmentally conscious consumers.

Step-by-Step Implementation Guide

To implement conditional shipping functions:

  1. From your Shopify admin, open the Sway Functions Generator app
  2. Navigate to "Create Function" → "Shipping"
  3. Select the function type (Hide Rates, Change Names, or Reorder)
  4. Configure your conditions:
    • Cart Qualifiers - Rules based on cart contents, weight, value, etc.
    • Customer Qualifiers - Rules based on customer tags, geography, history, etc.
    • Item Selectors - Product-specific rules based on collections, tags, variants, etc.
  5. Set your action (which rates to hide/rename/reorder)
  6. Add any customer messages to display
  7. Test thoroughly before activating

Advanced Configuration Tips

Combining Multiple Conditions

For complex scenarios, you can use AND/OR logic to combine multiple conditions:

Function: Conditionally Hide Rates
Configuration:
- IF (cart contains fragile items OR cart value > $300) AND shipping destination is international
- THEN hide economy shipping options

Using Customer Purchase History

For Shopify Plus stores, you can leverage customer purchase history in your shipping rules:

Function: Reorder Shipping Rates
Configuration:
- IF customer has ordered 5+ times in the past year
- THEN prioritize their previously selected shipping method

Seasonal Adjustments

Create time-based shipping rules for seasonal products:

Function: Conditionally Hide Rates
Configuration:
- IF cart contains products from "Holiday" collection AND current date is after December 15
- THEN hide standard shipping options
- Show message: "Express shipping recommended for holiday delivery"

Measuring Success

To evaluate the impact of your shipping function implementations, monitor these metrics:

Real-World Success: Global Fashion Retailer

A Shopify Plus fashion retailer with operations in 12 countries implemented conditional shipping functions to address regional-specific challenges:

Results:

Next Steps

Ready to optimize your shipping experience? Start by identifying your biggest shipping-related customer pain points, then implement a targeted shipping function to address them. For more help with specific shipping scenarios, book a consultation with our team.

Ask in our community
Question not answered? Ask us and other customers in the Sway customer community.
Go to community
Contact support
Message our support team privately to discuss anything specific to your organization
Contact support
Ask in our community
Question not answered? Ask us and other customers in the Sway customer community.
Go to community
Contact support
Message our support team privately to discuss anything specific to your organization
Contact support