Vote up!
Vote down!

Rule to change order status to "Completed" not visible and not working


A few weeks ago I gave Commerce a try and I liked it VERY MUCH. One thing I wondered about though, was why the orders stay in Pending state after a payment is submitted via PayPal (sandbox in my case).

I asked a question and got this response from Stephen W. :
"They are in pending status because that's the status they go to once they've been paid.
It's up to the administrator to use Rules or custom code to push the order through whatever status they want"

So I created a rule under Checkout Settings (Home Administration Store settings Advanced store settings Checkout settings Checkout rules ) by clicking the "Add a checkout rule" button. The rule settings were:
Name: "Set order status to completed"
Tags: Commerce Checkout

.. after that, in:
Events --> I removed the default event and added an event "When an order is first paid in full"
Conditions --> did not change anything
Actions --> Added "Update order state" and "Update order status" - because I was not sure which one I need. And I set the weight to 7 to make sure it is the last Rule in the chain.

I then saved this new Rule.
- - -
The problems:
1. The new Rule does not appear in the list of Rules for Checkout. Why? It does however appear in
"... Site settings Advanced settings Configuration Workflow Rules"
2. The Rule does not change the order status (or state? which one is it btw??) to Completed.

Thanks in advance to whoever could help me sort this out!!

Alexander Enchevich
on June 20, 2015


.. and by "the rule is not changing the state of the order" I mean that I did enter a new order.. I don't expect it to change existing ones of course.

- Alexander Enchevich on June 20, 2015

5 Answers

Vote up!
Vote down!

Ok so I figured out what the problem was...

It was actually decribed in my initial question:

.. after that, in:
Events --> I removed the default event and added an event "When an order is first paid in full"

To create this type of Rule you should not be replacing the default event "Completing the checkout process" with the "When an order is first paid in full" but simply add the "When an order.." event as a second event.

So now my Rule has 2 events: "Completing the checkout process" and "When an order is first paid in full". Orders's status is happily changed to Completed. I also change the State to Completed as well... not sure if it is necessary... and not sure what the difference is between State and Status... can anybody explain?

Alexander Enchevich
Posted: Jul 6, 2015
Vote up!
Vote down!

Hmmm. I just followed your steps and was able to see the rule in the right place. Not sure why it isn't updating on payment though. Perhaps the paypal full payment is not trigger the paid in full event?

I'd start by having you look in your order's payment log and the site watchdog to see if IPNs are coming through.

Jesse Nicola
Answer by: Jesse Nicola
Posted: Jun 30, 2015


Thanks Jesse, I'll look in the logs and watchdog to see if anything there could provide any clues...
In your test did you set your rule to update the State or the Status of the Order? Or both? Do you know why does Commerce need both and how is State diff from Status?

- Alexander Enchevich on July 2, 2015

Hi Jesse

Thanks for your help.

Unfortunately I could not see anything in the watchdog or the Order Logs that could pinpoint what the problem is :( AFAI can see the IPN goes thru just fine and yet the damn thing stays in Pending status.

To test this I enabled detailed IPN logging and created one more order and went thru the order payment steps again. I also generated some screenshots:

I also created an admin role account for you if you would like to take a quick look? Or anybody else for that matter? I am just not sure if it's a very good idea to post login info's here... even tho this a purely testing site with no live data and I don't think that the people who frequent this forum would do anything bad. But I am concerned that the drupal commerce forum moderators might delete my post for security reasons... So if any of the admins could confirm that it's not a problem I could post it here? Or else please contact me via skype (aenchevich) and I can give the login to you or whoever wants to look at this... (Contact Form seems to be disabled here so I can't think of a better way)

Also I can generate archives of the site and DB if that will help?

And also you can see here that the rule is not present in Checkout Rules but appears in Workflow rules (and also the settings of the Rule):

.. please help people.. this is driving me crazy! :(

- Alexander Enchevich on July 3, 2015
Vote up!
Vote down!

Based on...

1. IPN going thru ok
2. My rule does not appear in the list ot Checkout Rules

... I am thinking that the problem is that my custom rule is not triggered on Checkout.

So if anybody can see what is wrong with the setup of my rule (the last 3 screenshots in my previous post) and why is it not considered a checkout rule by drupal commerce?

Alexander Enchevich
Posted: Jul 3, 2015
Vote up!
Vote down!

.and if you don't see a big post with lots of screenshot links in it (two posts up from this one) it means that it still has not been cleared by the moderators. So my previous post won't make much sense then as it refers to it (sigh)...

Alexander Enchevich
Posted: Jul 3, 2015