Retrieving Value Added Tax included in price in a custom storefront

Shopify Partner
1 0 0

Hi everyone,


im building a frontend shop with the JS Buy SDK, but I am using the standard Shopify checkout, meaning, the buyer will enter their delivery address in the Shopify checkout. I have implemented a separate cart that displays the sum cost of items added to cart, but I would like to display Value Added Tax that is included in the sum cost.


I think I should be able to get the included tax through the JS Buy SDK / Custom Storefront API, since it is displayed in the Shopify checkout based on the buyers automatically detected country. However, the value of `totalTax.amount` or `totalTaxV2.amount` is always 0.


I've read that it might be required to set a shipping address (, but even if I supply a shipping address, the value remains at 0 and shippingAddress remains unset, but there isn't any error.


      shippingAddress: {
          address1: 'Musterstraße 1',
          address2: '',
          city: 'Berlin',
          zip: '10115',
          country: 'Deutschland'
      // This address doesn't return an error,
      // but an error is returned when 
      // adress1, city, zip or country are missing.
  }).then(async checkout => {
      setShopState('checkout', checkout);

      console.log("checkout created", checkout);
      // checkout.shippingAddress is null
      // checkout.totalTax.amount is 0 after adding line items and using new checkout from response.
      // checkout.totalTaxV2.amount is 0 after adding line items and using new checkout from response.

Do you have an Idea what I could try here? Is there way to get the tax data from an API based on only the country that the user is in, or automatically determined as in the checkout?


Thanks a lot!

Replies 0 (0)