Skip to main content

WooCommerce Filters

These filters require WooCommerce to be active.

currency

Formats a number as a price using WooCommerce's configured currency and formatting (via wc_price()). Respects your store's currency symbol, decimal separator, and thousand separator settings.

{{ product.price|currency }}
{{ product.regular_price|currency }}
{{ product.sale_price|currency }}

Output example: $29.99 or 29,99 € depending on store settings.

You can use currency on any numeric value, not just product fields:

{{ post.meta('custom_price')|currency }}
{{ 49.99|currency }}

Common Patterns

Product card with formatted prices

{% for product in get_posts({'post_type': 'product', 'posts_per_page': 6}) %}
<div class="product-card">
<h3>{{ product.title }}</h3>
{{ product.is_on_sale ? '<del>' ~ product.regular_price|currency ~ '</del> ' : '' }}
<span class="price">{{ product.price|currency }}</span>
</div>
{% endfor %}

Sale badge with discount percentage

{{ product.is_on_sale ? '-' ~ product.discount_percent ~ '%' : '' }}
Common mistake

product.price returns a raw number (e.g., 29.99). Without the currency filter, you lose the currency symbol and store formatting. Always use |currency when displaying prices.

Next steps