Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::get_payment_token_ids()publicWC 1.0

Get token ids for an order.

Метод класса: OrdersTableDataStore{}

Хуков нет.

Возвращает

Массив.

Использование

$OrdersTableDataStore = new OrdersTableDataStore();
$OrdersTableDataStore->get_payment_token_ids( $order );
$order(WC_Order) (обязательный)
Order object.

Код OrdersTableDataStore::get_payment_token_ids() WC 9.3.3

public function get_payment_token_ids( $order ) {
	/**
	 * We don't store _payment_tokens in props to preserve backward compatibility. In CPT data store, `_payment_tokens` is always fetched directly from DB instead of from prop.
	 */
	$payment_tokens = $this->data_store_meta->get_metadata_by_key( $order, '_payment_tokens' );
	if ( $payment_tokens ) {
		$payment_tokens = $payment_tokens[0]->meta_value;
	}
	if ( ! $payment_tokens && version_compare( $order->get_version(), '8.0.0', '<' ) ) {
		// Before 8.0 we were incorrectly storing payment_tokens in the order meta. So we need to check there too.
		$payment_tokens = get_post_meta( $order->get_id(), '_payment_tokens', true );
	}
	return array_filter( (array) $payment_tokens );
}