Archived topic
Query Block - WooCommerce - Display Currency
1 reply · Started by Kevin on December 6, 2022
Hey, actually, i've building a Landing page with the query block. To display the price, I'm using the headline block. Is there any way to display the currency in front of the price.
Thx
Hi Kevin,
You can add append-woo-symbol to the classist of the GB Headline Block.
Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/
Then add this snippet:
add_filter('generateblocks_dynamic_content_output', function($content, $attributes, $block){
if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'append-woo-symbol' ) !== false ) {
return get_woocommerce_currency_symbol() . $content;
}
return $content;
}, 10, 3);
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets