Automattic\WooCommerce\Blocks\Utils

BlocksSharedState::get_currency_dataprivate staticWC 1.0

Get currency data to include in settings.

Method of the class: BlocksSharedState{}

No Hooks.

Returns

Array.

Usage

$result = BlocksSharedState::get_currency_data(): array;

BlocksSharedState::get_currency_data() code WC 10.8.1

private static function get_currency_data(): array {
	$currency = get_woocommerce_currency();

	return array(
		'currency' => array(
			'code'              => $currency,
			'precision'         => wc_get_price_decimals(),
			'symbol'            => html_entity_decode( get_woocommerce_currency_symbol( $currency ) ),
			'symbolPosition'    => get_option( 'woocommerce_currency_pos' ),
			'decimalSeparator'  => wc_get_price_decimal_separator(),
			'thousandSeparator' => wc_get_price_thousand_separator(),
			'priceFormat'       => html_entity_decode( get_woocommerce_price_format() ),
		),
	);
}