WC_Order_Data_Store_CPT::untrash_order
Attempts to restore the specified order back to its original status (after having been trashed).
Method of the class: WC_Order_Data_Store_CPT{}
No Hooks.
Returns
true|false. If the operation was successful.
Usage
$WC_Order_Data_Store_CPT = new WC_Order_Data_Store_CPT(); $WC_Order_Data_Store_CPT->untrash_order( $order ): bool;
- $order(WC_Order) (required)
- The order to be untrashed.
WC_Order_Data_Store_CPT::untrash_order() WC Order Data Store CPT::untrash order code WC 10.3.5
public function untrash_order( WC_Order $order ): bool {
if ( ! wp_untrash_post( $order->get_id() ) ) {
return false;
}
$order->set_status( get_post_field( 'post_status', $order->get_id() ) );
return (bool) $order->save();
}