Get the "CPF/CNPJ" field from API Shopify

Hi. I’m trying to get the “CPF/CNPJ” field from API Shopify, but I cannot do it. This field stores the “Document ID” in Brazil. When I get a order using Orders Endpoint, this field doesn’t return. How can I get this information?

5 Likes

Same problem here. Any updates?

I also have this issue, same for South Korea. Any suggestions?

+1 ..

same problem here…

In case anyone is still looking for this, you need to fetch the order information from the GraphQL API, and the tax id for Brazil or South Korea is within the

localizationExtensions object.

You would get something like this for Brazil CPF/CNPJ:

"localizationExtensions": {
    "nodes": [
        {
            "countryCode": "BR",
            "purpose": "SHIPPING",
            "title": "CPF/CNPJ",
            "value": "000.000.000-00"
        }
    ]
},

And for the South Korean PCC:

"localizationExtensions": {
    "nodes": [
        {
            "countryCode": "KR",
            "purpose": "SHIPPING",
            "title": "Personal Customs Code",
            "value": "P000000000000"
        }
    ]
},
2 Likes

Thank you @VBlancoPR:grin: ‌ I was searching for this for so long.

1 Like

what GraphQL query? can I use the payment app graphql for this ?

Not sure about the Payments app API, cause I haven’t used that API, but the LocalizationExtension object is part of the order information which is available in the Admin apps API.

For those who need to search for the CPF/CNPJ via GraphQL, this is the query:

query { order(id: ""gid://shopify/Order/00000000000"" ) { name,
localizationExtensions(first:10){ nodes { purpose, countryCode, title, value } } } }

If you’re using the C# lib for Shopify GraphQL:

var result = ShopifyGraphQL.Net.Factories.GraphServiceFactory
                                .CreateGraphService("https://storename.myshopify.com/admin/api/2024-07/graphql.json", Token)
                                .PostAsync(@"query { order(id: ""gid://shopify/Order/000000000000"" ) { name,
                                    localizationExtensions(first:10){ nodes { purpose, countryCode, title, value } } } }")
                                .Result;
1 Like