snk/magento2-module-tax-updater

This package is abandoned and no longer maintained. No replacement package was suggested.

Magento 2 Console Command For Updating Tax Rates

0.1.1 2020-07-03 10:49 UTC

This package is auto-updated.

Last update: 2023-08-29 02:22:38 UTC


README

Extension for Magento 2

Overview

The module allows changing tax rates through magento console.

Requirements

Magento 2.2+, PHP >7.1

Installation

Just install it with composer in your project directory:

composer require snk/magento2-module-tax-updater

Usage

The command can be run as a normal Magento 2 console command with several options:

bin/magento tax:rate:update [--id [TAX RATE ID]] [--country [COUNTRY ISO2 CODE]] [--old-rate [OLD RATE] [--new-rate [NEW RATE]] [--dry-run [DRY RUN BOOL]]
  • --id: integer, the ID of tax rate entry to be changed
  • --country: ISO2 country code
  • --old-rate: float, percent value of the tax rate that should be looked for
  • --new-rate: float, the new percent value
  • --dry-run: boolean, if true, no data will be actually changed; useful for testing (NOTE: in order to work it must be explicitly set to true or 1)

If option ID is specified, then the script will only look for a tax rate with that ID and try to set the new percent value to it. If country and old rate are specified then the script will looks for corresponging tax rates and change them. This can be multiple rates, for example for different regions.

Do not forget to run indexing and clean the cache after chaging yout taxes.

Use cases

A famous use case for the script can be the change of VAT (Mehrwertsteuer, MwSt.) in Germany for 6 months from 01.07.20 to 31.12.20.

This script when used as a cronjob will automatically set the needed VAT value:

# Crontab

# VAT change in Germany

# From 19% to 16% on 01.07
0 0 1 7 * cd /var/www/share/www.yourshop.com/htdocs && bin/magento tax:rate:update --country DE --old-rate 19 --new-rate 16 >/dev/null 2>&1

# From 16% to 19% on 01.01
0 0 1 1 * cd /var/www/share/www.yourshop.com/htdocs && bin/magento tax:rate:update --country DE --old-rate 16 --new-rate 19 >/dev/null 2>&1

Authors

Oleh Kravets oleh.kravets@snk.de

Lisence

MIT