Shopify / checkout-sheet-kit-swift

Shopify’s Checkout Sheet Kit makes it simple to perform a checkout inside your Swift native app.
MIT License
29 stars 12 forks source link

Cart buyer identity is not pre-filled in the checkout #189

Open ShoMasegi opened 1 month ago

ShoMasegi commented 1 month ago

What area is the issue related to?

Checkout Sheet Kit

What version of Checkout Sheet Kit are you using?

3.0.1 (latest)

Reproducible sample code

MobileBuyIntegration Sample code

Steps to Reproduce

  1. Create a cart with buyerIdentity using the cartCreate API.
  2. Show CheckoutSheet using the cart's checkoutUrl.
  3. Do not pre-fill the buyerIdentity address (only pre-fill the email).

Expected Behavior

buyerIdentity data in Cart should be pre-filled including address in checkout

Actual Behavior

Do not pre-fill the buyerIdentity address (only pre-fill the email).

Screenshots/Videos/Log output

https://github.com/Shopify/checkout-sheet-kit-swift/assets/12663296/2c5233d8-6f8b-4d20-b90a-19936d151029

Storefront domain

ShoMasegi commented 1 month ago

@markmur Similar to this issue https://github.com/Shopify/checkout-sheet-kit-react-native/issues/77

markmur commented 1 month ago

@ShoMasegi can you share the contents of your Storefront.xcconfig file?

ShoMasegi commented 1 month ago

@markmur please check this. In actually, the STOREFRONT_DOMAIN and STOREFRONT_ACCESS_TOKEN are filled with actual values.

STOREFRONT_DOMAIN = <mydomain.myshopify.com>
STOREFRONT_ACCESS_TOKEN = <my storefront access token>
ADDRESS_1 = 千代田区1-2-3
ADDRESS_2 = 建物
CITY = 千代田区
COUNTRY = JP
FIRST_NAME = Test
LAST_NAME = McTest
PROVINCE = JP-13
ZIP = 100-0001
EMAIL = test-checkout-sdk@shopify.com
markmur commented 1 month ago

Adding a PHONE field will mostly likely fix this if the phone field is required for your store.

Prefilled address information is only presented when complete + valid.

You can find these settings under /settings/checkout in the admin for your store.

image
ShoMasegi commented 1 month ago

I tried adding a phone number to the deliveryAddressPreference address and changing the settings, but the same issue occurred.

markmur commented 1 month ago

If you manually enter the same address in the address form, is it considered valid?

ShoMasegi commented 1 month ago

Yes. I'm using the address returned as ShoppingAddress in the PixelEvent checkout_address_info_submitted. スクリーンショット 2024-07-12 1 22 12

sabir-nagarro commented 1 month ago

I am also facing the issue for the web. although @markmur adding phone field some times work.

markmur commented 1 month ago

Hey @ShoMasegi,

Looks like we don't have the PHONE field from Storefront.xcconfig wired up in our sample app. I've opened #193 to implement it.

The buyer experience should look like this when the address is valid (including the phone field):

image
ShoMasegi commented 1 month ago

@markmur I tried showing the checkout sheet using the same code (branch markmur/wire-phone-field) and the same values, but the values still weren't pre-filled. Is it possible that the settings of the checkout screen is causing this issue?

Kapture 2024-07-13 at 02 42 56

markmur commented 1 month ago

@ShoMasegi can you send me your storefront name or URL so that I can check this?

ShoMasegi commented 1 month ago

@markmur Here is my storefront URL: kauche-dev.myshopify.com

markmur commented 1 month ago

@ShoMasegi are you sure you have shipping rates set up correctly?

image

This is more likely an issue with your storefront configuration than an issue with the sheet kit.

ShoMasegi commented 1 month ago

@markmur The delivery address is not pre-filled even for products with correct shipping rates settings.

I understand that this issue is not caused by the sheet-kit. I'd like to close this issue. Finally, please tell me all conditions as much as possible under the delivery address of buyerIdentity might not be pre-filled.

kiftio commented 1 month ago

Hi @ShoMasegi Could you provide a cart ID or checkout URL for a time when you're able to reproduce it (for a product with correct shipping rates)? We should be able to check our logs to find out what happened

Can you also confirm if it's consistently happening, or something a bit more intermittent?

ShoMasegi commented 1 month ago

Hi @kiftio

Could you provide a cart ID or checkout URL for a time when you're able to reproduce it (for a product with correct shipping rates)?

CheckoutURL: https://kauche-dev.myshopify.com/cart/c/Z2NwLWFzaWEtc291dGhlYXN0MTowMUozNVQwQTYwRkcyUVNFVFFRSEo3VEdIWA?key=db938a589e024329a78e6ee827a5aa40

Can you also confirm if it's consistently happening, or something a bit more intermittent?

It's consistently happening

kiftio commented 1 month ago

Can you confirm you're creating the cart via the storefront API? We'd normally expect a /cart/cn URL in that case

ShoMasegi commented 3 weeks ago

@kiftio The cart is created with the storefront API (cartCreate API) in mobile-buy-sdk-ios v13.0.0. I have also tried this in v11.3.0, which is used in the sample, but the checkoutURL of the cart is /cart/c.

kiftio commented 3 weeks ago

OK, thanks I'll talk with the carts team to find out more

kiftio commented 3 weeks ago

OK, the carts team took a look through the logs and found an error related to some items in the cart being unable to ship from any location. They believe that this is the root cause of the issue.

They also mentioned that they're going to look into returning userErrors in this case, so there's more clarity on what has gone wrong.

ShoMasegi commented 2 weeks ago

Could you please advise on the next steps I should take? Should I wait for further information from regarding the return userErrors?