Hi!
Is it possible to remove the decimal values of the promotion price?
In the image attached, I want to remove the ,00 of the R$177,00 price, but the R$198,00 price must remains withe the ,00.
Hello there,
Yes, it is possible to remove the decimal values from the promotion price in Shopify. You can achieve this by using liquid, which is Shopify’s templating language, to format the price output.
Here’s an example of how you can modify the liquid code in your Shopify theme to remove the decimal values from the promotion price, while keeping the original price with decimal values:
{% assign regular_price = 177.00 %}
{% assign promotion_price = 198.00 %}
{{ regular_price | money }}
{{ promotion_price | money_without_currency | remove: '.00' }}
In this example, the regular_price and promotion_price variables are set to the respective prices. The money filter is used to format the regular price with the default currency and decimal values, while the money_without_currency filter is used to format the promotion price without the currency symbol and decimal values. The remove filter is then used to remove the ‘.00’ from the formatted promotion price, resulting in the desired output of the promotion price without decimal values.
You can adjust the code according to your specific theme’s liquid structure and variables to achieve the desired result. Please note that modifying the liquid code requires basic understanding of Shopify’s templating language and it’s recommended to make a backup of your theme before making any changes. If you’re not comfortable with liquid code, it’s recommended to seek assistance from a professional developer or the Shopify support team for further guidance.
@joaozinlv
add below code in price.liquid where compare price appear
{{ compare_at_price | money_with_currency | remove: '.00' }}