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.

CommentFileSizeAuthor
commerce_apply_taxes_price.patch1.75 KBfago

Comments

rszrama’s picture

Whoa, 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. : )

fago’s picture

yep :) Actions may provide new variables, as well as (action) components. You can even return multiple variables if you wish.

rszrama’s picture

Status: Needs review » Fixed

This 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

Status: Fixed » Closed (fixed)

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