Skip to main content
Shipping plugins allow you to connect any carrier API — or implement any custom rate logic — and surface the results as selectable shipping options during checkout. Each plugin receives a ShippingContext containing the full order details and returns a structured array of labelled rate options. The registration flow is identical to display plugins, so if you’ve already built one of those, building a shipping plugin will feel immediately familiar.

The ShippingPlugin Interface

Every shipping plugin must implement the following contract:

The ShippingContext Object

The ShippingContext passed to calculateRates() carries everything you need to compute a rate: Access these properties inside your plugin to call a carrier API or apply your own rate table logic.

Expected Return Format

calculateRates() must return a flat array of associative rate options. Each option requires a label and a numeric rate:
Site Store Pro renders each entry as a selectable shipping method at checkout. The customer sees the label, and the rate is added to the order total.
Return an empty array [] when no rates are available for the given context — for example, when the destination country is outside your coverage area. Site Store Pro will suppress the plugin’s options at checkout rather than showing a zero-rate entry.

Complete Example: Flat-Rate Shipping Plugin

Here is a minimal but fully functional shipping plugin that demonstrates reading a plugin setting and returning tiered flat rates:

Registering a Shipping Plugin

You can register a shipping plugin as a built-in class or as a drop-in directory — the process mirrors display plugins exactly.
Place your class in app/Plugins/Shipping/ and register it in app/Providers/PluginServiceProvider.php:
Then add the database record and any option fields via the PluginSeeder and reseed:
After registering your shipping plugin, navigate to Admin → Shipping → Methods to activate it and configure its settings. Inactive shipping plugins are never called during checkout rate calculation.

Plugin Model Helpers

The Plugin model passed to calculateRates() provides the same three convenience methods available to display plugins. Their formal signatures are:
Usage examples: