Carrier Service API - shipping rate request custom info

Topic summary

Developers are seeking ways to pass custom data (such as cart attributes or checkout tokens) from the cart page to Shopify’s Carrier Service API callback URL in order to return conditional shipping rates.

Core Problem:

  • The Carrier Service API request payload is predefined by Shopify and does not include cart attributes, checkout attributes, or checkout tokens.
  • This limitation prevents apps from accessing custom customer input when calculating shipping rates.

Confirmed Workaround:

  • Use line item properties instead of cart attributes. These properties persist from cart to checkout and are included in the Carrier Service request.
  • Add custom forms on the cart page that insert data as line item properties (e.g., split_shipment: true).
  • Parse these properties from the line_items array in the callback to conditionally return specific shipping rates.

Alternative Approaches Considered:

  • Switching products to variants with different SKUs based on customer selections (deemed clunky).
  • Using AJAX to add custom data as line item properties (confirmed working solution).

Status:
Shopify has not provided a native solution. The discussion remains open with developers sharing workarounds and requesting official support for passing custom data to Carrier Service callbacks.

Summarized with AI on October 26. AI used: claude-sonnet-4-5-20250929.

Re: Carrier Service API.

Is there anyway to get custom data from the cart page, or cart attributes, into the shipping rate request sent to the Carrier Service callback URL? Or, at the very least get the checkout token from the request?

I need to send back very specific rates under certain conditions (based on custom forms created on the cart page), without offering any other rates.

e.g.,

{
  "rate": {
    "origin": {
      …
    },
    "destination": {
      …
    },
    "items": [
      {
        …
      }
    ],
    "currency": “…”,
	“custom_note”: “a custom note added from the cart page”,
	// or
    “checkout_token”: “{token}”
  }
}

If I could at least get the checkout token from the request, I could (in an around and about way):

  • set the specific note I need on the line_item properties on the cart page

  • then when request callback comes through to the app, extract the checkout token

  • use the admin api to get the checkout

  • extract the property I initially set

  • validate accordingly

  • send the rates response

But, I don’t see the checkout token in the Carrier Service callback, so I can’t do that.

One workaround that might work:

  • use the ajax api to switch the products out on the cart page to products with the same name, but different sku’s, based on the customers form selections I create on the cart page

  • then in the external app, validate based on the sku

But, that’s an extra step of switching products out on the cart page that feels a little clunky. Any ideas or workarounds?

Cheers

T

Hey there,

There won’t be any way to add information to the existing requests that we send - those are pre-defined on our end and aren’t editable.

At best some sort of workaround like you had mentioned above would be required here since we don’t have any conventional way to accomplish this. I’ll let some other developers step and share any methods they’ve had success with though since I haven’t implemented something like this myself.

Thanks Josh, I thought that’d probably be the case. I’ll have to continue on with the product switch outs I think. Thanks for the reply.

Hi T_8,

We have faced the same issue: needed to pass some data from cart page to CarrierService callback.

The only solution we found so far was this: you can write some AJAX code to add your custom data as products “line item properties” on cart page:

https://help.shopify.com/en/themes/customization/products/features/get-customization-information-for-products

These “properties” will then be passed as a part of JSON request from Shopify to you CarrierService callback.

Hope this helps?

I have same issue. I need cart attributes

1 Like

@T_8 I have created a custom private carrier service app on the developer portal, but no data is posted to callback_url.

I added the log and the system does hit call back url, but for some unknown reason with no shipping data.

Can you please help me with this?

The scopes I defined are:

read_shipping, write_shipping, read_checkouts, write_checkouts

1 Like

I know this is old post and shopify have not given any solution for this. just keeping this here for their feedback

Yes, I’ve built a custom app to calculate shipping rates based on specific conditions—such as making split shipment optional—using Shopify’s CarrierService API.

Unfortunately, the CarrierService request during checkout doesn’t provide access to cart attributes, checkout attributes, or the checkout token, which makes it challenging to pass custom data from the storefront to the shipping rate callback.

Workaround:

To solve this, I ended up using line item properties, which do persist from the cart to checkout and are included in the CarrierService request payload. Here’s what I did:

  • I added custom forms on the cart page that insert data as line item properties (e.g., split_shipment: true).
  • During the CarrierService callback, I parse these properties from the line_items array.
  • Based on those properties, I conditionally return very specific shipping rates—and suppress all others when conditions aren’t met.

This approach ensures that my app only returns the desired shipping options based on the customer’s selection, even though checkout attributes or tokens are inaccessible via the CarrierService API.