Here is my code for updating order status in shopping cart to Checkout: Checkout. After running no error but it does not show order status as Checkout: Checkout.

function commerce_services_order_checkout_update($order_id,$data, $flatten_fields) {
    $status; $message;

    $status = $data['status'];

    $order = commerce_order_load($order_id);
    $order = commerce_order_status_update($order, "Checkout: Checkout");
    if($order != null){
        $status = 1;
        $message = "Order status set to checkout successfully.";
        $status = 0;
        $message = "Order status can not set to checkout.";

   $reply= (array('status' => $status,'message' => $message, "order status ". $order));

    return $reply;

Any suggestion is greatly appreciated!



This is your problem:

$order = commerce_order_status_update($order, "Checkout: Checkout");

You should be passing the machine name for the status

$order = commerce_order_status_update($order, 'checkout_checkout');

See this API doc page on drupalcontrib.org: http://www.drupalcontrib.org/api/drupal/contributions!commerce!modules!order!commerce_order.module/function/commerce_order_status_update/7

| improve this answer | |

You can change the order status using Rules module.

  1. Event -> Choose after adding products to the cart
  2. Action -> Update the status
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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