Wc_Tokens::wc_possible_tokens( array $tokens = array(), array $args = array(), string $type = 'order' )


Parameters Parameters

$tokens

(array) (Optional)

Default value: array()

$args

(array) (Optional)

Default value: array()

$type

(string) (Optional)

Default value: 'order'


Top ↑

Return Return

(array)


Source Source

File: src/integrations/woocommerce/tokens/wc-tokens.php

	public function wc_possible_tokens( $tokens = array(), $args = array(), $type = 'order' ) {

		$fields          = array();
		$trigger_meta    = $args['meta'];
		$possible_tokens = apply_filters( 'automator_woocommerce_possible_tokens', $this->possible_order_fields );
		foreach ( $possible_tokens as $token_id => $input_title ) {
			if ( 'billing_email' === (string) $token_id || 'shipping_email' === (string) $token_id ) {
				$input_type = 'email';
			} else {
				$input_type = 'text';
			}
			$fields[] = [
				'tokenId'         => $token_id,
				'tokenName'       => $input_title,
				'tokenType'       => $input_type,
				'tokenIdentifier' => $trigger_meta,
			];
		}
		$tokens = array_merge( $tokens, $fields );

		return $tokens;
	}