I'm using Commerce for the website I'm building right now. I want to trigger the event "Calculate the sell price" after an order is updated to a status, I made one called "Approved". The reason I want to do that is that the Tax is calculated at this event and at the "Checkout: Checkout" page, but the store manager wants to choose if the customer should pay tax or not, he wants to do that manually not using billing or shipping conditions.

I added a boolean field "Apply VAT?" to the order page and added a condition if that entity exists and is true to apply the VAT tax, but this is:not done at the checkout page and I noticed that if I change the status back to "Checkout: Checkout" the VAT tax is applied and this is because of the "Calculate the sell price" event (tell me if I'm wrong).

I was thinking to build a rule with the event "Order is updated" and the action to be a PHP code to invoke the event again, I know about rules_invoke_event, but I can't get it working.

I also have problems with the tax not being applied to the shipping cost, but this is another problem (maybe I will open another question of this)

I will appreciate any answers, thanks!

  • you can run php code in rules. May 22, 2013 at 7:28
  • Thanks for the quick answers, but I added rules_invoke_event("commerce_product_calculate_sell_price") to the actions of the rules I described above, but no luck.
    – mihior
    May 22, 2013 at 7:34
  • 1
    Maybe function is not globally available. Try to include the file where the function is written using module_load_include May 22, 2013 at 7:38
  • oh, great! I will try that and come back with an answer, thanks so much for the suggestions!
    – mihior
    May 22, 2013 at 7:49

1 Answer 1


I managed to invoke the event "calculate sell price" by adding a rule with the event "When existin line item is updated" and then adding a call to rules_invoke_event() in PHP code like this:

rules_invoke_event("commerce_product_calculate_sell_price", $commerce_line_item);

I was previously calling this rule incorrectly, without adding the $commerce_line_item so this problem is resolved, now the shipping remained.
Thanks for your time!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.