Modifying shipping/delivery in checkout extension

Hello Shopify community :smiley:

I’m working on a custom Shopify Checkout UI extension and I need some guidance.

My goal is to change the shipping price dynamically based on the delivery agent the customer selects. I’ve built a custom interface where users can select from a list of delivery options and agents (retrieved via an API), and that part works fine.

However, I’m not sure how to programmatically update the shipping cost once an agent is selected. I’ve read through the Checkout UI Extensions docs but I can’t find a clear way to set or override the actual shipping line or price.

Some context:

  • I’m using the "purchase.checkout.shipping-option-item.render-after" extension point.
  • I fetch delivery options based on the shipping address.
  • I then show a list of agents and let the user choose one.
  • Now I want the selected agent’s delivery cost to reflect in the checkout total.

Is there a way to:

  1. Dynamically set the shipping price based on agent selection?
  2. Or replace the Shopify shipping option with my own?

I’m aware of Shopify Functions, but wasn’t sure if they’re needed in combination with UI Extensions or how they integrate in this case.

Any tips or examples would be super appreciated!

Thanks,
Alija

Hey @Alija_Fajic :waving_hand: - shipping rates themselves are “owned” by the different carrier agents, so can’t be modified super easily within checkout. If you did want to offer completely custom rates, the easiest way to do this would be through our Carrier Services API:

You could also look into using discount codes to modify the price of the order if you did want to offer lower shipping costs dynamically (more info here), though this wouldn’t apply directly on the shipping rate.

I’d recommend going with the Carrier Service API if you did want to offer fully customizable rates that can be generated based on checkout info. Hope this helps!

1 Like