Skip to content

Instantly share code, notes, and snippets.

@fastdivision
Last active February 13, 2017 21:43
Show Gist options
  • Save fastdivision/0ae7be19aa25155f74cc7c06a38b64ae to your computer and use it in GitHub Desktop.
Save fastdivision/0ae7be19aa25155f74cc7c06a38b64ae to your computer and use it in GitHub Desktop.
Magento + TaxJar Custom Product Taxability Exceptions by State
<?php
// Include around here:
// https://github.com/taxjar/taxjar-magento-extension/blob/master/app/code/community/Taxjar/SalesTax/Model/Smartcalcs.php#L236
// Taxable in one state, exempt in other exempt states
$specialTaxableProducts = array(1001, 1002, 1003, 1004); // Product IDs
// Tax these clothing products if shipped to PA
if (in_array($item->getProductId(), $specialTaxableProducts) && $address->getRegionCode() == 'PA') {
$taxCode = ''; // Fully taxable
}
// Taxable in multiple states, exempt in other exempt states
$specialTaxableProducts = array(1001, 1002, 1003, 1004); // Product IDs
$specialTaxableStates = array('MN', 'PA');
// Tax these Clothing products if shipped to MN or PA
if (in_array($item->getProductId(), $specialTaxableProducts) && in_array($address->getRegionCode(), $specialTaxableStates)) {
$taxCode = ''; // Fully taxable
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment