checkout-sheet-kit-swift icon indicating copy to clipboard operation
checkout-sheet-kit-swift copied to clipboard

Address in cart.delivery not displayed

Open mzsanford opened this issue 1 month ago • 0 comments

What area is the issue related to?

Checkout Sheet Kit

What version of Checkout Sheet Kit are you using?

3.3.0

Steps to Reproduce (with code)

  1. My iOS app is collecting address as an earlier part of the flow (address in the example code below).
  2. My Swift code creates a cart using the Storefront SDK like so:
let addressInput = Storefront.CartDeliveryAddressInput.create(address1: .value(address.streetAddress),
                                                                address2: .init(orNull: address.streetLine2),
                                                                city: .value(address.city),
                                                                countryCode: .value(.us),
                                                                firstName: .value(address.firstName),
                                                                lastName: .value(address.lastName),
                                                                provinceCode: .value(address.state),
                                                                zip: .value(address.zipCode))

let cardAddress = Storefront.CartSelectableAddressInput.create(
    address: Storefront.CartAddressInput.create(deliveryAddress: .value(addressInput)),
    selected: .value(true),
    oneTimeUse: .value(true)
)

let buyerIdentityInput = Storefront.CartBuyerIdentityInput.create(email: .value(user.emailAddress()))

let deliveryInput = Storefront.CartDeliveryInput.create(addresses: .value([cardAddress]))

// cartLine created with Storefront.CartLineInput.create
let cartInput = Storefront.CartInput.create(lines: .value([cartLine]),
                                            buyerIdentity: .value(buyerIdentityInput),
                                            delivery: .value(deliveryInput))

let createCartMutation = Storefront.buildMutation { $0
    .cartCreate(input: cartInput) { $0
        .cart { $0
            .id()
            .checkoutUrl()
        }
    }
}
  1. With the resulting checkout URL, display Checkout Sheet Kit in SwiftUI via CheckoutSheet(checkout: url)
  2. For some users they see a previous address in the CheckoutSheet instead of the current address.

Expected Behavior

I would expect a cart created with a single cart.delivery address, with selected=true, to show that address and only that address.

Actual Behavior

If a user uses our product twice they are sometimes presented the last address passed to CheckoutSheet instead of the current address. I assume there are cookies in play overriding the cart configuration but I can find no way to avoid them.

Storefront domain

aura-2.myshopify.com

mzsanford avatar Nov 19 '25 21:11 mzsanford