How to import WooCommerce tax rates using a PHP script?
I have created a CSV file with WooCommerce tax rates and want to import it with a PHP script. How can I do this?
I wrote this code:
<?php // path to the file on my system require "../wp-content/plugins/woocommerce/woocommerce.php"; $wc_importer = new WooCommerce\Admin\Importers\WC_Tax_Rate_Importer(); $wc_importer->import('test.csv');
but when I run it like this:
$ php -d display_errors=1 -f import.php
nothing happens. There is no output to the console. Thank for your help.
PS: I understand this site does not welcome WooCommerce questions but I believe this question is more about PHP programming than WooCommerce hence trying to post it here.
I think there could be couple of issues here:
- How to import the package correctly
- How to direct messages to console