update_status doesn’t work as it should.
-
The “Delivery Driver” plugin displays a list of orders and their status.
In order to change the status, it is necessary to access the orders one by one.
I’m trying to improve this.
On the “My Account” screen, a list of orders is displayed for the delivery person.
I added a button, I should change the “status” of the order when clicked.
What happens is that he is not changing the status of only the order of the clicked button, he is changing all the orders in the list.
Does anyone know if something is wrong in my code?
echo '<td>' . wc_get_order_status_name( $order_status ); if('driver-assigned' == $order_status ){ if(isset($_POST["outfordelivery2"])){ $order->update_status( 'out-for-delivery' ); } echo ' <form method="post"> <input type="submit" value="' . esc_attr__( 'Out for Delivery', 'ddwc' ) . '" class="button ddwc-change-status" name="outfordelivery2" /> </form> '; } if('out-for-delivery' == $order_status ){ if(isset($_POST["ordercompleted2"])){ $order->update_status( 'completed' ); } echo ' <form method="post"> <input type="submit" value="' . esc_attr__( 'Completed', 'ddwc' ) . '" class="button ddwc-change-status" name="ordercompleted2" /> </form> '; } echo '</td>';
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘update_status doesn’t work as it should.’ is closed to new replies.