FROM CACHE - fr_header
Cette communauté a fait place à une assistance de pair-à-pair. L’assistance Shopify ne sera plus proposée pour cette communauté. Nous vous encourageons à entrer en contact avec d’autres marchands et partenaires pour obtenir de l’aide et partager vos expériences ! Veuillez continuer à signaler tout ce qui va à l'encontre de notre Code de conduite ou tout contenu que vous souhaitez faire supprimer.

Incorrect variant price amount using admin GraphQL api

Incorrect variant price amount using admin GraphQL api

BastienPaquier
Shopify Partner
1 0 0

Hi everyone

 

We are facing an issue with the validity of the data we get out of a product query using the admin graphql api.

Here is the query we use : 

query getProduct($id: ID!) {
    product(id: $id) {
        variants(first: 10) {
            nodes {
                id
                price_eu: contextualPricing(context: {country: FR}) {
                    price {
                        amount
                        currencyCode
                    }
                }
                price_uk: contextualPricing(context: {country: GB}) {
                    price {
                        amount
                        currencyCode
                    }
                }
                price_us: contextualPricing(context: {country: US}) {
                    price {
                        amount
                        currencyCode
                    }
                }
            }
        }
    }
}

the contextual pricing amount differs from the call we make locally or via Postman with the one executed from vercel,

On one hand we have the correct response (from local or Postman):

{
    "data": {
        "product": {
            "variants": {
                "nodes": [
                    {               
                        "price_eu": {
                            "price": {
                                "amount": "1400.0",
                                "currencyCode": "EUR"
                            }
                        },
                        "price_uk": {
                            "price": {
                                "amount": "1281.0",
                                "currencyCode": "GBP"
                            }
                        },
                        "price_us": {
                            "price": {
                                "amount": "1425.0",
                                "currencyCode": "USD"
                            }
                        }
                    }
                ]
            }
        }
    },

    }
}

On the other hand we have an incorrect response (from vercel call)

{
    "data": {
        "product": {
            "variants": {
                "nodes": [
                    {
                        "price_eu": {
                            "price": {
amount: '1388.34', "currencyCode": "EUR" } }, } ] } } }, }

As you can see the price_eu fiel is not sending the same value,

 

What is the solution for this problem?

this is a very big issue for us as it create problems for customer visiting the shop.

Thanks for your help and have a good day

0 RÉPONSES 0