$order = new Order(12345); // create a new order object with ID 12345 $current_state = $order->getCurrentState(); // get the current state of the order echo "Order " . $order->getId() . " is currently " . $current_state; // prints "Order 12345 is currently shipped"
$order = findOrderById(67890); // find an existing order with ID 67890 $current_state = $order->getCurrentState(); // get the current state of the order if($current_state == 'delivered') { sendCustomerReviewRequest($order->getCustomerId()); // if the order is delivered, send a review request to the customer }In this example, we first find an existing order with ID 67890, then call getCurrentState to get its current state. We then use an if statement to check if the order has been delivered, and if so, use the getCustomerId function to retrieve the customer ID and send them a review request. Possible package library: E-commerce Order Management Library.