Attached is a patch which improves the action "commerce_tax_rate_apply" to provide back the applied tax amount as price. So one can make use of that price in subsequent rules.
My use case:
Conditionally apply a tax, but keep the original price value. So with the improvement I can easily subtract the tax amount from the base-price after applying the tax.
| Comment | File | Size | Author |
|---|---|---|---|
| commerce_apply_taxes_price.patch | 1.75 KB | fago |
Comments
Comment #1
rszrama commentedWhoa, is this a new feature of Rules that I didn't know about? If we return a value, Rules can actually make use of that in other data selectors or tokens or something? If so, I have several other places in mind where this would be very useful. : )
Comment #2
fagoyep :) Actions may provide new variables, as well as (action) components. You can even return multiple variables if you wish.
Comment #3
rszrama commentedThis is soooo cool, fago. I've already been putting 'provides' to use elsewhere and wanted to make sure I came back to this patch before the 1.1! The only thing I changed on commit was to make the name of the provided variable match its label, so it's applied_tax instead of just tax. Thanks so much. : )
Commit: http://drupalcode.org/project/commerce.git/commitdiff/e2a44d1