D
D
Denys2017-11-07 15:45:51
Drupal
Denys, 2017-11-07 15:45:51

Drupal Commerce. How to make a discount cumulative discount?

I'm trying to make a cumulative discount for site users. The conditions are simple:
if the amount of orders placed is from 1000 to 2000, then the client's discount on the next order is 3%, if from 2000 to 5000, then 5%, etc. Plus, all this should be accumulated and remembered at the user level, I think everything is clear for the purpose.
And so the first thing I did - in the "management of user fields" I created a field in which I will record the client's turnover, after which I will calculate the discount depending on the turnover through the rules according to the condition.
Next, you need to create a "rule" that will count the client's turnover.
Do:
Event - after updating an existing order.
Condition - "Data comparison" order status must be set to "Completed". (because I don't want to give a discount for unfinished orders)
Action - "Calculate value" commerce-order:total (total order amount) + site:current-user:field-oborot (current user's "turnover" field) = result
"Set value" client turnover = result
Result: everything works, BUT the turnover is considered by the one who changes the status of the order, i.e. the current user who is in the condition is the admin who changes the status of the order.
Help to make the right condition or even consider ready-made solutions in the form of modules.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
andead, 2017-11-07
@dmyasnykov

Use commerce-order:owner:field-oborot instead of site:current-user:field-oborot You
may need to add the Entity has field condition to make Rules see the field_oborot field.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question