less than a minute read • Updated 8 minutes ago
Add Custom Shipping Code
Step by step: add custom shipping code to your store.
Overview
This article walks through adding custom shipping code to your store from the Foxy admin. For what custom shipping code can do and how it works, see Custom Shipping Code. For ready to use code, see Custom Shipping Code Examples.
Before you start
Custom shipping code runs for categories whose delivery type is set to "Shipped using live shipping rates." Make sure the categories you want to affect are set to that delivery type and have a default weight configured. You can set this up in the Categories section of your admin.
Steps
Recommended: prevent rate tampering
On the same Shipping page, enable Prevent shipping rate tampering. This signs each shipping rate and verifies it hasn't been altered between the cart and checkout submission. Leave this off only if you still rely on legacy browser side rate snippets.
Test your code
Add a product from an eligible category to your cart and proceed to checkout with a shipping address. Your custom rates should appear among the shipping options. If you don't see the rates you expect:
Confirm the product's category delivery type is "Shipped using live shipping rates."
Confirm the code was saved and deployment finished (the method shows "Active").
Check that your code adds at least one rate (or returns an error) for the address you're testing.
Edit or update your code
To change your code later, return to the Shipping page, click Custom Shipping Code again, edit the code, and Save. Each save triggers a fresh deployment.