UPS Shipping Plugin for Craft Commerce Kevin Hamer

Written on: July 26th, 2017 in engineering, labs

Today, Imarc Labs is open sourcing a plugin for Craft Commerce integrating with UPS's shipping API to pull back shipping prices.

Available here:

Craft Commerce's Built-In Shipping Logic

Craft Commerce is an e-commerce platform for Craft CMS. It provides product, promotion and order management, supports 20-30 different payment gateways and basic analytics.

Out of the box, Craft Commerce provides a lot of configuration options for shipping. You can specify a base rate as well as cost based on each product's quantity, weight, and/or price. You can specify all of these based on shipping location as well as minimum and maximum order quantities, prices and weights.

For example, you could offer a two day shipping option like this:

  • For orders over $25 being shipped within the United States, shipping is free;
  • For orders over $25 being shipped internationally, charge $5/lb being shipped, minimum of $10;
  • For orders under $25, charge $10 for shipping.

And a cheaper, slower shipping option like this:

  • For orders being shipped within the US, shipping is free;
  • For international orders, charge $2.50/lb being shipped, minimum of $5.

Bottom line: Craft Commerce's built-in shipping cost configurations offer a lot of flexibility.

UPS Shipping Plugin for Direct Cost Lookups

In certain cases, sellers may want to rely on explicit shipping quotes directly from UPS.

That's why we developed a Craft Commerce plugin for UPS for connecting to UPS's Shipping API to pull back shipping estimates.

The plugin uses gabrielbull/php-ups-api, and can pull back prices for shipments via UPS Ground through UPS Next Day Air Early AM. It's integrated into Craft Commerce so these shipping methods show up just like any of the others.

Limitations and Recommendations

However, UPS's Shipping API has some limitations. For example, it requires the dimensions and weight of the package being shipped. We chose to default all estimates to be based off of UPS's standard shipping. Our plugin does not take advantage of UPS’s flat rate boxes or shipping envelopes. Craft Commerce doesn't provide practical packing logic; this plugin provides some basic logic, but still overestimates sizes.

If you have specific products you're selling in branded packaging at known sizes and weights and you need real UPS estimates, this plugin may be useful to you. For most ecommerce, I'd recommend using Craft Commerce's built in configuration to define shipping policies that make the most sense for your business.


Download the UPS Shipping Plugin for Craft Commerce on our GitHub.

Also check out Imarc's other GitHub repositories or follow @imarclabs on Twitter.


Let's Talk.