NY Luxury Taxes with discounts and Magento

tax-change

The Problem: If a coupon is given that decreases a products total from being greater than $110, to less than $110 a new Tax rate / class has to be applied.

:arrow: http://www.nystax.gov/pdf/notices/n09_12.pdf

I eventually solved it by with making a copy of /app/code/core/Mage/Subtotal.php to /app/code/community/Mage/Subtotal.php and modifying _unitBaseCalculation(), you’ll need to make sure your Tax Class ID’s are setup the same as whats in the code, as well as using Tax Calculation Method Based On “Unit Price” for the code to execute properly, its not pretty but does the job, ultimately would be best to get the tax class ID’s some other way and use return parent::_unitBaseCalculation() towards the end to incorporate the previous magento methods but this should do the trick for now. The attribute “package_id” is an additional product attribute to determine if the product is a shoe or not. region_id 43 is NY.

protected function _unitBaseCalculation($item, $request)
    {
        // If USD and from NY Region, apply tax rate based on grand total
        if(Mage::app()->getStore()->getCurrentCurrencyCode() == "USD" && $request['region_id'] == "43") {
            if($item['discount_amount'] != 0) {
                $package_id = Mage::getModel('catalog/product')->load($item['product_id'])->getAttributeText('package_id');
                if($package_id == "SHOES") {
                    $price_minus_discount = $item['price'] - $item['discount_amount'];
                    if($price_minus_discount < 110) {
                        //$rate = "4.375";
                        $item->getProduct()->setTaxClassId('7');
                    } else {
                        //$rate = "8.875";
                        $item->getProduct()->setTaxClassId('6');
                    }
                }
            }
        }

:arrow: http://www.magentocommerce.com/boards/viewthread/210021/#t291817

Possibly Related Posts: