Overview
Shipping Customization Functions let you modify shipping rates, hide/show shipping options, rename delivery methods, and add custom shipping logic based on cart contents, location, or customer data.Use Cases
Hide Shipping Methods
Remove options based on conditions
- Hide express for remote areas
- Remove free shipping below threshold
- Restrict by product type
Adjust Rates
Modify shipping costs dynamically
- Add handling fees
- Apply discounts
- Bulk order pricing
- Weight-based adjustments
Rename Methods
Customize shipping option names
- Add delivery estimates
- Show carrier names
- Include pricing details
Reorder Options
Change shipping method order
- Promote fastest option
- Prioritize cheapest
- Customer preference
How It Works
1
Checkout Loads
Customer enters shipping address in checkout
2
Rates Calculated
Shopify calculates available shipping rates
3
Function Executes
Your function receives cart data and shipping rates
4
Rates Customized
Function returns modified rates and options
5
Checkout Updates
Customer sees customized shipping options
Example: Free Shipping Threshold
Generate a function that offers free shipping over $100:1
Describe Your Function
2
Review Generated Code
Synapse creates:
- Function logic (Rust or JavaScript)
- Input query for cart and shipping data
- Rate modification logic
- Configuration
3
Deploy & Test
- Automatic validation
- Deployed to dev store
- Test with different cart totals
4
Test in Checkout
- Add items to cart
- Go to checkout
- Enter shipping address
- See customized shipping options
Generated Function Structure
Function Code Examples
- Free Shipping Threshold (Rust)
- Hide Express for Remote Areas (JavaScript)
- Add Handling Fee
- Input Query
Common Patterns
Cart Value Shipping Tiers
Cart Value Shipping Tiers
Different shipping costs at different cart values:Prompt Example:
Product-Based Restrictions
Product-Based Restrictions
Hide shipping options based on cart contents:Prompt Example:
Location-Based Pricing
Location-Based Pricing
Adjust shipping rates by destination:Prompt Example:
Add Delivery Estimates
Add Delivery Estimates
Show estimated delivery dates in shipping option names:Prompt Example:
Operation Types
Shipping functions support these operations:- Update
- Hide
- Move
Modify shipping rate or name:
- Change rate amount
- Update display name
- Modify description
Advanced Examples
Weight-Based Pricing
Weight-Based Pricing
Customer Tier Shipping
Customer Tier Shipping
Bulk Order Shipping
Bulk Order Shipping
Testing Shipping Functions
1
Test in Checkout
- Add items to cart
- Go to checkout
- Enter various shipping addresses
- Verify rates update correctly
2
Test Different Scenarios
- Various cart values
- Different product combinations
- Multiple shipping addresses
- International vs domestic
3
Check Function Logs
4
Performance Testing
- Should execute in under 5ms
- Test with many shipping options
- Large cart edge cases
Best Practices
Always Show Options
Never hide all shipping methodsEnsure at least one method remains visible
Clear Messaging
Explain rate changesShow why fees added or discounts applied
Handle Errors
Graceful fallbacksReturn empty operations on errors, don’t crash
Performance
Keep functions fastMinimize loops, use Rust, cache calculations
Example Prompts
Progressive Free Shipping
Progressive Free Shipping
Fragile Item Handling Fee
Fragile Item Handling Fee
Express for VIP Only
Express for VIP Only
Remote Area Surcharge
Remote Area Surcharge
Troubleshooting
No Shipping Options
No Shipping Options
Cause: Function hiding all methodsSolution: Add safeguard to keep at least one visible
Rates Not Updating
Rates Not Updating
Cause: Price calculation errorSolution: Check Decimal parsing, handle errors with unwrap_or
Function Not Running
Function Not Running
Cause: Deployment issueSolution: Check deployment logs, verify function active