Programatically Creating a Product or Customer Tax Class

Published by John on April 1, 2017 Under Magento

This is a short post today, but I was unable to find a good reference for manually creating tax classes.

If you need to create a Product Tax Class or a Customer Tax Class programatically, you can use the below code:

Creating a Product Tax Class


$tax_class = Mage::getModel('tax/class');
$tax_class->setClassName('my_new_tax_class')
	->tax_class->setClassType('PRODUCT');
$tax_class->save();

Creating a Customer Tax Class


$tax_class = Mage::getModel('tax/class');
$tax_class->setClassName('my_new_tax_class')
	->tax_class->setClassType('CUSTOMER');
$tax_class->save();


No Comments |

Add a Comment