Troubleshoot Distance Shipping Issues in Magento 2
Looking for Magento 2 distance-based shipping extension? View the full Magento 2 distance-based shipping extension page to explore features, configuration options, and pricing.
Solutions for common issues with the Shipping Costs Based on Distance extension.
Shipping Method Not Showing
Check Basic Configuration
- Module Enabled: Magmodules → Shipping Costs Based on Distance → General → Enabled = Yes
- Shipping Method Enabled: Shipping Method → Name and Position → Enabled = Yes
- API Key Set: General → API and Location Details → API Key is filled in
- Store Address Set: General → API and Location Details → Store Address is filled in
Check Limit Rules
- Country: Is the customer's country in the allowed countries list?
- Distance: Is the customer within the maximum distance limit?
- Order Amount: Does the order meet the minimum order amount requirement?
Check Product Conditions
If conditions are enabled:
- Are all cart products eligible for distance-based shipping?
- If using "Show only for eligible products," ensure products meet criteria
- Check the product attribute used for eligibility
Test the API Connection
- Click Test Credentials in configuration
- Run CLI selftest:
bin/magento distancebasedshipping:selftest - Check if API key is valid and has proper permissions
Wrong Shipping Price Calculated
Verify Pricing Table
- Check that distance ranges don't have gaps
- Ensure the customer's distance falls within a defined range
- Review fixed price and per-km rate settings
Check Rounding Settings
- Round Distance: Affects the distance used in calculations
- Round Total Price: Affects the final displayed price
Review Price Caps
- Minimal Price: Is the calculated price being raised to minimum?
- Maximum Price: Is the calculated price being capped?
Check Free Shipping
- Is free shipping enabled?
- Does the order meet the free shipping threshold?
Debug the Calculation
- Enable Debug Mode in configuration
- Place a test order
- Check logs in
var/log/for calculation details
API Errors
"API key not valid"
- Verify the key is copied correctly without extra spaces
- Check the key exists in Google Cloud Console
- Ensure the key hasn't been deleted or regenerated
"Distance Matrix API has not been used"
- Enable Distance Matrix API in your Google Cloud project
- Wait a few minutes after enabling
- Verify you're using the correct project
"REQUEST_DENIED"
- Check API key restrictions in Google Cloud Console
- Verify billing is set up on the project
- Ensure server IP is whitelisted (if IP restriction is enabled)
"OVER_QUERY_LIMIT"
- You've exceeded your API quota
- Wait for quota to reset (daily/monthly)
- Consider upgrading your Google Cloud plan
"ZERO_RESULTS"
- Google can't find a route between addresses
- Verify store address is valid and findable
- Customer address may be incomplete or invalid
"INVALID_REQUEST"
- Store or customer address is malformed
- Check address format in configuration
- Ensure address includes all required components
Address Not Found Issues
Store Address Problems
- Test your store address in Google Maps directly
- Use full address format: street, city, postal code, country
- Avoid PO Box addresses
- Don't use special characters
Customer Address Problems
Configure fallback behavior:
- Go to Shipping Method → Address Not Found
- Choose Hide shipping method or Show with message
- Set a helpful error message for customers
Shipping Estimation on Product Page
Not Showing
- Check Add Shipping Estimation to Product Page is enabled
- Clear cache after enabling
- Verify the product page template supports the estimation block
Showing Wrong Price
- Product page estimation uses entered postcode only
- Full address at checkout may result in different distance
- This is expected behavior
Performance Issues
Slow Checkout
- Distance calculation adds API latency
- Enable caching if available
- Consider using a closer Google Cloud region
High API Costs
- Monitor usage in Google Cloud Console
- Set up billing alerts
- Review if unnecessary API calls are being made
Cache Issues
After configuration changes:
bin/magento cache:flush
For persistent issues:
bin/magento cache:clean
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
Debug Mode
Enable detailed logging:
- Go to Magmodules → Shipping Costs Based on Distance → Debug & Logging
- Set Debug Mode to Yes
- Click Save Config
Logs are written to var/log/. Look for:
- API request/response details
- Distance calculation steps
- Price calculation breakdown
- Any errors or warnings
Note: Disable debug mode in production to reduce log size.
Selftest
Run the built-in diagnostic:
bin/magento distancebasedshipping:selftest
The selftest checks:
- Module configuration
- API connectivity
- Required settings
- Common misconfigurations
Common Scenarios
Shipping Shows for Some Customers, Not Others
- Check distance limits - some customers may be too far
- Verify country restrictions
- Check if customer's address is findable by Google
Price Different Than Expected
- Review the pricing table and calculation method
- Check which distance range applies
- Verify rounding settings
- Look for min/max price caps
Method Disappeared After Working
- API key may have expired or been deleted
- Billing may have been disabled on Google Cloud
- Configuration may have been changed
- Run selftest to diagnose
Need More Help?
Documentation:
- All Help Articles - Complete documentation overview
Support:
- Contact Support - Get help from our team
When contacting support, include:
- Magento and extension version
- Selftest results
- Debug log excerpts (if applicable)
- Screenshots of configuration
- Steps to reproduce the issue
For a complete overview of features and configuration options, see Magento 2 distance-based shipping extension.