Last active
December 25, 2015 00:39
-
-
Save jonhattan/6889423 to your computer and use it in GitHub Desktop.
Snippet to detect an order status change.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_commerce_order_update(). | |
*/ | |
function HOOK_commerce_order_update($order) { | |
// Detect a status change. | |
if ($order->status != $order->original->status) { | |
$status = commerce_order_status_load($order->status); | |
$state = commerce_order_state_load($status['state']); | |
// Checkout phase starts. | |
if (($state['name'] == 'checkout') && ($order->status == $state['default_status'])) { | |
dpm("First step in checkout"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment