Default Store Tax Rate

Created on 5 April 2024, 8 months ago
Updated 30 May 2024, 6 months ago

Describe your bug or feature request.

Hello, i have two stores, one set up at andorra, which charges IGI (general indirect tax) everywhere, and other in Spain, where the tax rate is VAT for EU members, but IGIC and IPSI if they are located in special regions inside spain.
So id did set up a global IGI tax and restricted it to items for the andorra store, and created the other taxes and restricted them to the spanish store.

Currently i'm using prices_include_tax at the store level.
When someone tries to buy something for the spanish shop from outside the taxed area, StoreTax->getDefaultRates is called, and it asumes IGI (cause it was the first tax i created, but the order is not determined) should be substracted.
There should be something to select the default tax, or to limit the taxes to stores.
Kind regards

💬 Support request
Status

Fixed

Version

2.38

Component

Tax

Created by

🇪🇸Spain Pandepoulus

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Pandepoulus
  • Status changed to Fixed 7 months ago
  • 🇮🇱Israel jsacksick

    There should be something to select the default tax, or to limit the taxes to stores.

    You can add conditions to tax types? See the attached screenshot.

  • 🇪🇸Spain Pandepoulus

    I do have IGI configured just for the Andorran store. Anyway, in the Spanish store, when someone buys from outside the EU where there is no appliable tax, as the "prices includes tax" is selected, the resolver tries to look for a "default tax" to substract to the price. And it selects the andorran IGI.

    When there is no tax, getDefaultTaxType from StoreTax is called.
    the code, which i add here:

      public function getDefaultTaxType(StoreInterface $store) {
        $store_id = $store->id();
        if (!array_key_exists($store_id, $this->storeTaxTypes)) {
          $store_address = $store->getAddress();
          $tax_types = $this->getTaxTypes();
          $this->storeTaxTypes[$store_id] = NULL;
          foreach ($tax_types as $tax_type) {
            /** @var \Drupal\commerce_tax\Plugin\Commerce\TaxType\LocalTaxTypeInterface $tax_type_plugin */
            $tax_type_plugin = $tax_type->getPlugin();
            $matching_zones = $tax_type_plugin->getMatchingZones($store_address);
            if ($matching_zones) {
              $this->storeTaxTypes[$store_id] = $tax_type;
              break;
            }
          }
        }
    
        return $this->storeTaxTypes[$store_id];
      }

    Just iterates for al taxes ($this->getTaxTypes()) and checks for addresses. As IGI is a universal tax, its zone matches and is returned as the default tax for the spanish tax to subsctract the price when there is no tax configured. (outside EU).
    There is no validation that the tax is appliable for the store.
    Hope i have explained it better.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024