Hi,

I want to give a discount depending on the payment method choosed...
i.e: 5% of discount if the payment method choosed is Bank Transfer...

Is possible to detect the payment and give the discount with Rules?
Or we need a feature request or a contributed module?

Thank you very much!

Comments

rszrama’s picture

Title: Discount based on payment method » Add a condition to check the currently selected payment method
Category: support » feature

It's not possible right now, because we need a special condition to detect the payment method selected in Checkout. I thought there was an issue for this already, but I didn't find it on a quick search so I'll leave this open.

ytsurk’s picture

i would also be interested in this !

may be a condition ?

rszrama’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Active » Fixed

Just added this in. Merry Christmas.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/10f0287

ytsurk’s picture

here first test results ..,

i worked with version 7.1 - do i have to use all -dev ?
and added the above new code.

i could use the condition in product pricing rules and in the tax rule component.
(i guess the rule component is the right place ?)
but it does not change when updating the paymentmethod on the /review page ..

thx santaRay

rszrama’s picture

Yeah, it won't be possible to make it change anything on that AJAX request, but if you have a page after the payment method selection it will be effective then. Also, you don't have to use all -dev, just Commerce until we roll the 1.1 release hopefully later today.

ytsurk’s picture

woaw -- keep it going :D

ytsurk’s picture

.. i dont get it ... :(

could you pls explain me where to set the condition to have the intended behavoir,
that is:

after the submit of the selected paymentmethod on /review,
the rule should be fired > sales tax added, if paymentmethod equals a specific
and then to see the result on /payment, showing the order there ?

- in my opinion, i add the new condition here: admin/config/workflow/rules/components/manage/,
plus adding the action 'After updating an existing commerce line item' here: admin/config/workflow/rules/reaction/manage/
(after trying a lot of combinations)

i get these messages in the dblog:

Unable to evaluate condition commerce_payment_selected…
The variable or parameter commerce_order is empty.
ytsurk’s picture

got it working now ..

could it be that it is all so simple

just added the condition to the standard SalesTax ReactionRule,
and moved the paymentselection to step 1 in admin/commerce/config/checkout/form

as the standard action - calculate price - is not fired after changing payment-method only ..

brunorios1’s picture

My experience with this feature:

1) i created a new Tax "Payment Method Discount"
admin/commerce/config/taxes/types/add

2) i added a condition "Selected payment method comparison" to this tax type rule
admin/commerce/config/taxes/types/payment-method-discount/rule

Data Selector: commerce-line-item:order
Payment Method: [choose the method that you want to give a discount]

3) i added a reaction "Calculate taxes for a line item" to this tax type rule
admin/config/workflow/rules/reaction/manage/commerce_tax_type_payment_method_discount/add/1/action

Data Selector: commerce-line-item
Tax type: Payment Method Discount

4) I added a new Tax Rate
admin/commerce/config/taxes/rates/add

Evaluate: -.05 (5% discount)
Type: Payment Method Discount

5) I moved the "Payment" pane to the step "Checkout" in the checkout form and the "Shopping cart contents" to the step "Review order"
admin/commerce/config/checkout/form

It's working!
This is the right method?

Thank you very much for this feature!

Status: Fixed » Closed (fixed)

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

leramulina’s picture

Issue summary: View changes

Thank you! This post helped me!
brunorios1 - Thank you very much!

roxart’s picture

maybe here someone can help? :) not sure but shouldnt it also work in pos?
https://drupal.stackexchange.com/questions/243556/why-does-the-selected-...