Taxes are added to the price including tax when retrieving product information

Assumption.

  • Storefront API is used to build and operate the store.
  • Product prices are registered with tax included.

I don’t know how long this has been happening, but suddenly the prices of items on the product page and collection page are being obtained with the tax amount added to the price registered as including tax.

In the admin page, for each product, I check the box to charge tax, and in the overall settings, I set the price to include tax.

The amount after adding to cart and on the checkout page is the amount I registered for the product.

I didn’t know how to solve this problem, so I did a product amount / 1.1 to handle it.

Does anyone know how to get the correct amount in the API response?

Translated with DeepL.com (free version)

Hi @Kenji_Iwase, this does seem like odd behaviour, happy to help take a look into this.

Could you share your exact GraphQL query/mutation you’re using and whether you’re using the @inContext directive or passing buyer identity when you’re displaying the products? Also it you could share your market configuration and a specific example showing the registered price versus the API response (or how it’s displayed on the frontend) that would be super helpful.

The fact that checkout works correctly suggests this is likely a context issue in your product queries via the SFAPI (or in Liquid if you’re using a theme) rather than a configuration problem as you’ve mentioned.

Hope to hear from you soon - happy to investigate further for sure.

Hi @Alan_G, thank you for your reply.

I’ve checked the GraphQL query.
I’m using the @inContext directive.
※ API version is 2024-10

We primarily do business in Japan, but we occasionally ship overseas for some customers, so we specify country and language using the @inContext directive.

When I tested without the directive on our local development environment at http://localhost:3000/graphiql, I was able to retrieve the registered price amount (including tax).
When I set Country to JP, it returned an amount that was 10% higher than the tax-inclusive price.
When I set it to US, it also returned an amount that was 10% higher.

In the product price registration, I have checked the “Charge tax on this product” option (I’m not sure of the exact English wording).

Reference image

The tax settings (https://admin.shopify.com/store/xxxx/settings/taxes) are configured as follows:

  • In global settings, “Include tax in product prices and shipping” is checked
  • In regional tax settings, Japan has tax collection enabled with a 10% tax rate set

Reference image

The query I’m using to fetch products is written as follows:

const PRODUCT_QUERY = `#graphql
  query Product(
    $country: CountryCode
    $handle: String!
    $language: LanguageCode
    $selectedOptions: [SelectedOptionInput!]!
  ) @inContext(country: $country, language: $language) {
    product(handle: $handle) {
      id
      title
      vendor
      handle
      descriptionHtml
      description
      availableForSale
      options {
        name
        optionValues {
          id
          name
        }
      }
      selectedVariant: variantBySelectedOptions(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {
        availableForSale
        compareAtPrice {
          amount
          currencyCode
        }
        id
        image {
          __typename
          id
          url
          altText
          width
          height
        }
        price {
          amount
          currencyCode
        }
        product {
          title
          handle
        }
        selectedOptions {
          name
          value
        }
        sku
        title
        unitPrice {
          amount
          currencyCode
        }
      }
      variants(first: 1) {
        nodes {
          availableForSale
          compareAtPrice {
            amount
            currencyCode
          }
          id
          image {
            __typename
            id
            url
            altText
            width
            height
          }
          price {
            amount
            currencyCode
          }
          product {
            title
            handle
          }
          selectedOptions {
            name
            value
          }
          sku
          title
          unitPrice {
            amount
            currencyCode
          }
        }
      }
      collections(first: 10) {
        nodes {
          title
          handle
          metafields(identifiers: [
            {namespace: "custom", key: "is_exclude_breadcrumb"},
          ]) {
            key
            value
          }
        }
      }
      seo {
        description
        title
      }
      metafields(identifiers: [
        {namespace: "custom", key: "official_name"},
        {namespace: "custom", key: "blanciris_collection_name"},
      ]) {
        id
        key
        namespace
        value
        type
        reference {
          ... on Metaobject {
            id
            type
            fields {
              key
              value
              reference {
                ... on Collection {
                  id
                  title
                  handle
                  products(first: 250) {
                    nodes {
                      id
                      handle
                      title
                      availableForSale
                      images(first: 1) {
                        nodes {
                          __typename
                          id
                          url
                          altText
                          width
                          height
                        }
                      }
                      priceRange {
                        minVariantPrice {
                          amount
                          currencyCode
                        }
                        maxVariantPrice {
                          amount
                          currencyCode
                        }
                      }
                      variants(first: 1) {
                        nodes {
                          availableForSale
                          compareAtPrice {
                            amount
                            currencyCode
                          }
                          id
                          image {
                            __typename
                            id
                            url
                            altText
                            width
                            height
                          }
                          price {
                            amount
                            currencyCode
                          }
                          product {
                            title
                            handle
                          }
                          selectedOptions {
                            name
                            value
                          }
                          sku
                          title
                          unitPrice {
                            amount
                            currencyCode
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      images(first: 20) {
        nodes {
          __typename
          id
          url
          altText
          width
          height
        }
      }
      priceRange {
        minVariantPrice {
          amount
          currencyCode
        }
        maxVariantPrice {
          amount
          currencyCode
        }
      }
      tags
      productType
      seo {
        title
        description
      }
    }
  }
` as const;

I’m passing the price amount from the retrieved variants to Hydrogen’s Money component for display.

This might be affected by the market settings.
I have two markets configured - the top one is for international, and the bottom one is for Japan.

Hey @Kenji_Iwase, thanks for the follow up! I think I see what’s happening here. Your 国際 (International) market has a +10% price adjustment (全体の調整) applied, which explains the higher prices for US queries.

For Japan, it looks like the 10% consumption tax is being added on top of your prices, even though you have tax-inclusive pricing enabled. These are two different 10% increases:

  • International/US: Market-level price adjustment (+10%)
  • Japan: Tax being incorrectly added to already tax-inclusive prices

Since you mentioned you have “Include tax in product prices” checked in your global tax settings, the Japan market shouldn’t be adding tax again. Are you setting the 10% tax for Japan in your tax settings here rather than as a market adjustment?

The fact that checkout shows correct prices suggests this might be an issue with how the Storefront API’s @inContext directive handles tax-inclusive pricing. Your workaround of dividing by 1.1 makes sense for now.

Can you confirm if this matches what you’re seeing? I’d like to investigate further and potentially dig into this internally as I believe that tax-inclusive pricing should work correctly with @inContext.

@Alan_G, thank you for the confirmation.

Are you setting the 10% tax for Japan in your tax settings here rather than as a market adjustment?

Yes, that’s correct.

Japan is checked on the https://admin.shopify.com/store/xxx/settings/taxes page, and a 10% tax rate is set on the https://admin.shopify.com/store/xxx/settings/taxes/JP page.

In the market settings, Japan is configured as follows, so no market adjustment is applied:

Can you confirm if this matches what you’re seeing?

Yes, it matches. However, upon further review, I found a new issue.

Here’s the situation with examples:

■ Admin Settings

  • Market setting
    • International (non-Japan)
      • +10% on product prices
    • Japan
      • No settings configured
  • Tax setting
    • Tax-inclusive
    • In global settings, “Include tax in product prices and shipping” is checked
    • In regional tax settings, Japan has tax collection enabled with a 10% tax rate set

■ API Response

  • Japan
    • +10% on product prices
    • Corrected by dividing by 1.1
  • Non-Japan
    • +10% on product prices
    • Correct
      • However, since we’re applying dividing by 1.1 globally, ideally no processing should be needed

■ Checkout

  • Japan
    • Displays the originally registered product price
  • Non-Japan
    • Displays originally registered product price + shipping
    • The +10% market adjustment is not reflected on the checkout page

I’ll create a test store and investigate further. If you discover anything through your internal investigation, I’d appreciate it if you could let me know.

1 Like

Hi @Kenji_Iwase - thanks again for your clarifications here and the follow up, if you are able to replicate the issue in a test shop and share that test shop’s myshopify.com URL (either here on in a direct message which I can set up), I’m happy to take a look at that shop and investigate further on my end so that we can escalate this to our product teams if need be.

Just ping me here if you’d like to move to a direct message and I can create that on my end :slight_smile:

@Alan_G, thank you for your confirmation.

I apologize, but after investigating various aspects, I thought I had reproduced the issue in the test store, but when I checked again, it was working normally (though I’m sure I was able to reproduce it at that time).

The test store is as follows: https://blanciris-test-store.myshopify.com

Also, the current situation was as follows:

  • Production
    • Checkout page
      • International market amount is not increased by 10%
      • Japan market amount is correct
    • API from Hydrogen
      • International market amount is increased by 10% and is correct
      • Japan market amount is increased by 10% and is incorrect
    • Others (creating an app and making GraphQL requests locally with access token, requests from Shopify GraphiQL App)
      • International market amount is increased by 10% and is correct
      • Japan market amount is increased by 10% and is incorrect
  • Test store
    • Checkout page
      • International market amount is increased by 10% and is correct
      • Japan market amount is correct
    • API from Hydrogen
      • Cannot be confirmed as Hydrogen cannot be installed in the test store
    • Others (creating an app and making GraphQL requests locally with access token, requests from Shopify GraphiQL App)
      • International market amount is increased by 10% and is correct
      • Japan market amount is correct

※ API version is 2024-10

I think recreating the market in the production environment shop might fix it, but what do you think? I apologize for the repeated inquiries, but please confirm.

Hi again @Kenji_Iwase, thanks for the detailed update and no problem at all, very happy to help! The fact that your test store works correctly while production doesn’t (with identical settings) does make it seem like this is a configuration issue specific to your production environment.

Before recreating the Japan market, could you try to verify there are no other price adjustments by querying your Japan market via the Admin API to check the priceList.adjustmentType and adjustmentValue fields. You should be able to make a query like this using the admin API:

query {
  market(id: "gid://shopify/Market/id-here") {
    priceList {
      id
      parent {
        adjustment {
          value
          type
        }
      }
    }
  }
}

If you can’t find any adjustments that way, they I’d definitely recommend trying to duplicate the Japan market settings (create new, disable old temporarily), and if that fails, then recreate the market entirely as you suggested.

If the issue persists though, I’my happy to escalate this internally. If you still see the issue after trying the workaround there, could you share your production store’s myshopify URL (here or via DM - I can set one up) so I can investigate with our engineering team? Thanks again for your patience on this!

Thank you for the correction! Here’s the updated English translation:

@Alan_G, thank you for your reply.

Yesterday, I recreated the market and catalog from scratch. As a result, the issue that was causing the problem has been successfully resolved. That’s great.

Since I hadn’t particularly modified the market and catalog since the site launch, there might have been some issue with the summer update. The market UI had also changed, so there might have been something with the migration or similar processes.

I don’t know the exact cause, but I’m glad it’s fixed. Thank you for your quick reply, confirmation, and support.

I’ll reach out again if anything else comes up.

Hey @Kenji_Iwase - glad to hear everything is working well for you now!

I’ll mark this thread as solved for now, but if the issue does pop up again, just @ me in this thread here and I’m more than happy to take another look.

Hi, @Kenji_Iwase.

I was having the same problem, but I was able to solve it by changing this part in the admin screen from “動的な税金表示” to “算入として表示する”.

I hope this helps.

References:
「設定」→「マーケット」→「日本」→「関税及び輸入税」