Mastering Custom B2B Shipping: $0 Rates & Hidden Methods on Shopify Checkout
Hey everyone, I recently stumbled upon a fantastic discussion in the Shopify community that tackled a really common and often tricky B2B shipping challenge: allowing customers to use their own shipping accounts (like UPS) for $0 shipping, while simultaneously hiding all other shipping options at checkout. This is a game-changer for many wholesale and B2B stores, and the community really dug into some powerful new Shopify features to crack it wide open.
Our fellow store owner, JoeBTI, kicked off the thread with a very clear problem. He was trying to implement a “Ship on My UPS Account” option directly within the Shopify checkout’s shipping block. The goal was twofold: if a customer selected this, he needed to hide all other shipping methods AND update the shipping cost to $0.00. He’d been experimenting with Checkout UI Extensions and Functions but wasn’t seeing a direct path to hiding or repricing. He even shared a screenshot of his setup:
The Initial Thought: Post-Order Adjustments?
Steve_TopNewYork weighed in, suggesting that “Checkout UI Extensions can’t dynamically hide other shipping methods or set the selected shipping rate to $0 based on a customer’s choice” directly. His workaround involved capturing the UPS account details during checkout and then adjusting the charge or issuing a refund after the order was placed. This is a common approach for many complex scenarios, but let’s be honest, extra manual steps post-order can be a real pain and introduce errors. It’s definitely a fallback, but not ideal for a smooth, automated workflow.
The Real-Time Solution: UI Extensions + Delivery Customization Functions
Thankfully, HamidEjaz jumped in with the definitive answer, clarifying that this is absolutely “doable,” but it requires combining two powerful Shopify features. He pointed out that while the UI piece (the Checkout UI Extension) can’t hide or reprice delivery options by itself, it plays a crucial role in triggering the action. The magic happens when you pair it with a Delivery Customization Function.
Here’s the brilliant breakdown:
-
A Delivery Customization Function does the heavy lifting of hiding. This Function “reads a cart attribute and returns
hideoperations for every method except your UPS one.” It’s designed precisely for this kind of control — hiding, renaming, and reordering delivery options. -
Your Checkout UI Extension sets that attribute. When your customer selects “Bill to my UPS account” in the UI extension you’ve built, it uses
applyAttributeChangeto set a specific cart attribute. This attribute then acts as the “key” that the Delivery Customization Function looks for.
Now, here’s the important “catch” Hamid highlighted: “delivery customizations can hide and rename, but they can’t change a rate&rsquos price.” This means you can&t just dynamically set an existing rate to $0.00. Instead, you need to create a real $0.00 flat rate in your Shopify admin, named something like “Ship on my UPS account.” The Function will then simply hide all the other rates, leaving only your pre-configured $0.00 rate visible.
This combined approach ensures the entire process happens live at checkout, eliminating the need for any post-order adjustments or refunds, whether you’re using CarrierService rates or standard Shopify Shipping rates.
Putting it into Action: Your Step-by-Step Guide
So, how do you actually implement this? Here’s a simplified guide based on the community’s insights:
1. Set Up Your $0.00 Shipping Rate
First things first, you need to create the actual shipping rate that your customers will see. This is done directly in your Shopify admin.
- Navigate to Settings > Shipping and delivery.
- Find the shipping profile you need to edit (e.g., General shipping rates).
- Add a new custom flat rate for your relevant shipping zones. Name it clearly, something like “Ship on My UPS Account,” and set the price to $0.00. This rate will initially be visible to all customers, which is fine because our Function will later control its visibility.
2. Develop Your Checkout UI Extension
This is where your customer interacts. You’ll build a Checkout UI Extension that adds a custom field or checkbox to the shipping section of your checkout.
- Create the UI: Your extension will render a UI component (e.g., a checkbox, radio button, or input field for a UPS account number) that allows the customer to indicate they want to use their own UPS account.
- Set the Cart Attribute: When the customer selects this option, your UI Extension needs to use the
applyAttributeChangeAPI to set a specific cart attribute. For example, you might set an attribute like_use_ups_account: true. This attribute is crucial as it’s what your Delivery Customization Function will “read.”
3. Build Your Delivery Customization Function
This is the “brain” that controls which shipping rates are displayed. This Function will be triggered during the checkout process and will dynamically modify the available shipping options.
- Create the Function: You’ll develop a Shopify Function (likely using Rust or WebAssembly) that listens for delivery customizations.
- Read the Cart Attribute: Inside your Function’s logic, you’ll check the incoming cart object for the attribute you set in your UI Extension (e.g.,
_use_ups_account). - Apply Hiding Logic: If the attribute is present (meaning the customer selected “Ship on My UPS Account”), your Function will then generate
hideoperations for all other shipping methods, leaving only your “Ship on My UPS Account” ($0.00) rate visible. If the attribute is not present, the Function will simply return without making any changes, allowing all standard rates to show.
This approach is incredibly powerful because it leverages Shopify’s modern extensibility features to provide a seamless, real-time experience for your B2B customers. No more clunky post-order refunds or manual adjustments — everything is handled directly and elegantly within the checkout flow.
It’s a fantastic example of how combining different Shopify developer tools — Checkout UI Extensions for front-end interaction and Delivery Customization Functions for back-end logic — can solve complex business needs. Definitely worth exploring if you’re looking to offer advanced shipping options on your store!
