Dynamic Shipping Rates Based on Product Dimension Metafields

Hi everyone,

I’m looking for some guidance on how to set up more accurate shipping cost calculations for my store.

Currently, when a customer orders a product, the shipping cost calculated at checkout is based on my store’s single default package size. The issue is that my products vary significantly in size, so this default calculation is often inaccurate. It can lead to overcharging customers for shipping on small items or, conversely, undercharging and losing money on shipping for larger items.

My ideal solution is to have the shipping rate dynamically calculated based on the specific dimensions of the product(s) in the cart. I’ve already considered adding the following metafields to each product to store its dimensions:

  • custom.dimension_length
  • custom.dimension_width
  • custom.dimension_height

My question is: How can I use these product dimension metafields to influence the real-time shipping rate calculation at checkout?

I’m trying to figure out the best way to approach this. Is this something that can be achieved with a Shopify Function (using the new Shipping Functions API)? Would I need to build a custom app that interfaces with a carrier API? Or is there another method I’m not aware of like changing plan?

Any advice, examples, or pointers to the right documentation would be greatly appreciated.

Shipping Discount Functions and Discount Functions can apply discounts to shipping rates that are already calculated by Shopify or your carrier integrations. For example, you can offer free shipping, a percentage off, or a fixed discount based on cart contents, customer tags, or product collections.

However you can’t override or dynamically set the base shipping rate calculation logic (i.e., you cannot change how Shopify or your carrier calculates the shipping cost based on dimensions or weight).

Shopify’s built-in shipping rate calculation uses the default package size you set in your shipping settings. If you want rates to be based on actual product dimensions, you need to use a third-party carrier-calculated shipping app or a custom app that acts as a carrier service.


This was one of the responses from the app support team, which serves my purpose. They stated that while the app can determine the box size, the recommended product size must be adjusted according to the app’s suggestions. However, during checkout, the rate is calculated based on the default box size only.