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