1. Create a VAT-style tax
  2. Create a product and have the price be inclusive of that tax
  3. Test
  4. Delete the tax
  5. The shopping cart is broken with the line item for tax still there.

    The only workaround is to enable a VAT tax again (so that the inclusive select form element will show) and then re-save each affected product.

    This probably only break existing carts.

    Here's what it looks like:
    rfay_screenshot_sony_000.png

CommentFileSizeAuthor
rfay_screenshot_sony_000.png7.32 KBrfay

Comments

rszrama’s picture

Title: Product with tax inclusive is broken if the tax is removed » Update tax inclusive prices when tax rates are updated or deleted
Component: Checkout » Tax

I'm going to make this issue a little more generic; what needs to happen is updating or deleting a tax rate should involve a batch recalculation if there are any prices saved including that tax rate.

rszrama’s picture

Status: Active » Fixed

Well, I finally implemented a change that had been too long in coming. Instead of calculating the included tax prior to save and storing the actual components, we're now just storing the tax rate name that should be included in the price. The tax is then calculated on load via hook_field_attach_load(), so it's future safe. Tax rates can change, and as long as the field cache is cleared, taxes will be recalculated for all products on load. The only bummer here is that it's not worth it to try and write an update function. Product forms will have to be resubmitted to update to the new data model. This is a rarely used feature, and I know it will be disappointing for those who are using it, but it's just not worth the time and hassle of the crazy batch in an update function. Can't wait to get price components out of that serialized data column...

Commit: http://drupalcode.org/project/commerce.git/commitdiff/dbcbccb

rfay’s picture

It would be possible to do a VBO + rule to update all products....

rszrama’s picture

Hmm, if Rules can execute a form. Good thought, though. I did realize after posting last night that while products will have outdated data arrays, at least they'll be outdated with tax included... so the main thing they'll be missing is "future proofness."

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.