Abstract_WC_Order_Data_Store_CPT::order_exists
Check if an order exists by id.
Method of the class: Abstract_WC_Order_Data_Store_CPT{}
No Hooks.
Returns
true|false. True if an order exists with the given name.
Usage
$Abstract_WC_Order_Data_Store_CPT = new Abstract_WC_Order_Data_Store_CPT(); $Abstract_WC_Order_Data_Store_CPT->order_exists( $order_id ): bool;
- $order_id(int) (required)
- The order id to check.
Changelog
| Since 8.0.0 | Introduced. |
Abstract_WC_Order_Data_Store_CPT::order_exists() Abstract WC Order Data Store CPT::order exists code WC 10.3.3
public function order_exists( $order_id ): bool {
if ( ! $order_id ) {
return false;
}
$post_object = get_post( $order_id );
return ! is_null( $post_object ) && in_array( $post_object->post_type, wc_get_order_types(), true );
}