Working with custom Shipping Methods

New Member
9 0 0

This is for an iPhone app using the Shopify SDK.

 

I'm trying to get a shipping method to carry through the checkout flow.

 

For example, the app may offer Individual Shipping (USPS) or In-Store Pickup and each has it's own rate.

 

Right now if I choose In-Store Pickup and then checkout, I'm presented with a checkout page that already has that shipping method pre-selected.

 

If I go the other route, I have to input a shipping address, then tap continue to shipping, but the USPS option is not selected by default. 

 

Not sure what to check for this though. Is this managed from the mobile Shopify SDK or something else?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
202 23 22

 

Hey @lukeirvin 

 

When the user selects the alternate shipping address, are you setting that chosen shipping method with the following mutation: https://github.com/Shopify/mobile-buy-sdk-ios#updating-shipping-line-

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes
New Member
9 0 0

Hi @vix,

 

Yes, so if a user chooses an option other than individual shipping, that mutation gets called.

 

 

 

0 Likes
New Member
9 0 0

Hi @vix , any suggestions for this problem?

0 Likes
Shopify Staff
Shopify Staff
202 23 22

 

Hi @lukeirvin Is there any snippet of code you can share? If I was troubleshooting this I would be confirming I was completing all the steps in order. 

 

1. update shipping address

2. poll for available rates

3. Set shipping lines with the correct handle 

 

 

 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes
New Member
9 0 0

@vix I'll see if there is anything I can share, but basically this is what's happening:

 

If it's an individual shipping ---> Marks this as complete and takes user into a web view where they can input their shipping address, then choose 'Continue to Shipping' where instead of defaulting to USPS they are defaulted to a custom shipping option but still see the other options and would have to select USPS.

 

If it's In Store or Group Shipping, an address is already provided, so I can call methods to lookup the shipping rates & update the shipping rates. So when the final method is completed and the user is taken to the web view they are presented at the Checkout screen with the address there and the correct shipping option already selected.

 

So, how can I do those below if an address doesn't initially exist? 

 

I've also found that if I do provide an address for the Individual option this does work, but if the user chooses to change the address it takes them out of this flow and back to the one above where USPS is not defaulted.

0 Likes
Shopify Staff
Shopify Staff
202 23 22

 

Thank you for the context - very helpful! 

 

The shipping address is required to pre-select the shipping method. This is because we need to check that it is applicable. As you have tested, the only way around this is to pass a shipping address prior to redirecting to the WebURL. You could collect this from within your app, or continue with the way it works and have the customer select this on the WebURL. 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes
New Member
9 0 0

@vix so my follow up to that is why does the checkout process work as expected if I just go to the website via an internet browser, but doesn't work via the iPhone app / Shopify SDK?

 

When I go to individual checkout it's loading all my pre-saved addresses.

0 Likes
Shopify Staff
Shopify Staff
202 23 22

 

 

Do you have an example you can provide? Do you mean the online store or did you build out a storefront with the Storefront API? The more information you can provide the better I can look into your questions. 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes
New Member
9 0 0

@vix maybe both? There were previous developers on this before myself.

 

The URL to view the store via internet browser is ---- https://www.b-unlimited.com/

 

But yes, the iOS app uses StoreFront.

0 Likes