Shopify / mobile-buy-sdk-ios

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.
MIT License
452 stars 198 forks source link

product is not published for this customer error #1219

Closed sppzglou closed 1 year ago

sppzglou commented 1 year ago

my method is that:

val input = Storefront.CheckoutCreateInput() .setLineItemsInput( Input.value( listOf( Storefront.CheckoutLineItemInput(1, ID(graphQlId)) ) ) )

val query = Storefront.mutation { mutationQuery -> mutationQuery.checkoutCreate(input) { createPayloadQuery -> createPayloadQuery.checkout { checkoutQuery -> checkoutQuery.webUrl() }.checkoutUserErrors { userErrorQuery -> userErrorQuery.field().message() } } }

    graph.mutateGraph(query).enqueue { result ->
        if (result is GraphCallResult.Success) {
            val errors = result.response.errors
            val userErrors =
                result.response.data?.checkoutCreate?.checkoutUserErrors?.map { it.message }
            if (errors.isNotEmpty()) {
                emit(null, Exception(errors.first().message()))
            } else if (userErrors?.isNotEmpty() == true) {
                emit(null, Exception(userErrors.first()))
            } else {
                emit(result.response.data?.checkoutCreate?.checkout?.webUrl, null)
            }
        } else {
            emit(null, Exception((result as GraphCallResult.Failure).error.message))
        }
    }

on result.response.data?.checkoutCreate?.checkoutUserErrors I received this error "Variant the product is not published for this customer." on the same product/variant on web shopify site the checkout works without any error.

Στιγμιότυπο οθόνης 2023-10-28, 11 50 35 μμ