Shopify / mobile-buy-sdk-android

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 their credit card.
MIT License
216 stars 136 forks source link

Checkout error product is not published for this customer #753

Open sppzglou opened 11 months ago

sppzglou commented 11 months ago

my method is that:

fun getCheckoutUrl(graphQlId: String, emit: (String?, Exception?) -> Unit) { 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 μμ
Varghese1987 commented 3 months ago

We are also facing the same issue. However, after some time, this error resolves itself, and we are able to check out the same product through the Mobile Buy SDK. It would be great if someone could help us identify the root cause of this issue and provide a corrective action. Thank you.