WC_Payment_Tokens::get_order_tokens()
Returns an array of payment token objects associated with the passed order ID.
Method of the class: WC_Payment_Tokens{}
Hooks from the method
Return
WC_Payment_Token[]
. Array of token objects.
Usage
$result = WC_Payment_Tokens::get_order_tokens( $order_id );
- $order_id(int) (required)
- Order ID.
Changelog
Since 2.6.0 | Introduced. |
WC_Payment_Tokens::get_order_tokens() WC Payment Tokens::get order tokens code WC 9.3.3
public static function get_order_tokens( $order_id ) { $order = wc_get_order( $order_id ); if ( ! $order ) { return array(); } $token_ids = $order->get_payment_tokens(); if ( empty( $token_ids ) ) { return array(); } $tokens = self::get_tokens( array( 'token_id' => $token_ids, ) ); return apply_filters( 'woocommerce_get_order_payment_tokens', $tokens, $order_id ); }