Tribe__Tickets__Commerce__PayPal__Order::find_by_order_id( string $order_id, bool $use_post_id = false )
Finds an order by the PayPal order ID (hash).
Contents
Parameters
- $order_id
-
(string) (Required) The PayPal order ID (hash).
- $use_post_id
-
(bool) (Optional) Whether the
order_idparameter should be used as a PayPal Order ID (hash) or as a post IDDefault value: false
Return
(int|false) Either an existing order post ID or false if not found.
Source
File: src/Tribe/Commerce/PayPal/Order.php
public static function find_by_order_id( $order_id, $use_post_id = false ) {
global $wpdb;
$query = $use_post_id
? "SELECT ID from {$wpdb->posts} WHERE ID = %d AND post_type = %s"
: "SELECT ID from {$wpdb->posts} WHERE post_title = %s AND post_type = %s";
$order_post_id = $wpdb->get_var(
$wpdb->prepare(
$query,
trim( $order_id ),
Tribe__Tickets__Commerce__PayPal__Main::ORDER_OBJECT
)
);
return ! empty( $order_post_id ) ? (int) $order_post_id : false;
}
Changelog
| Version | Description |
|---|---|
| 4.7 | Introduced. |