# 割引の場合に％offと表示させたい

**URL:** <https://community.shopify.com/t/off/194886>\
**Category:** 技術的なQ＆A\
**Created:** [February 25, 2023, 1:13am UTC](https://community.shopify.com/t/off/194886 "2023-02-25T01:13:23Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![mira0](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mira0](https://community.shopify.com/u/mira0)\
**Post date:** [February 25, 2023, 1:13am UTC](https://community.shopify.com/t/off/194886/1 "2023-02-25T01:13:23Z")

</div>

テーマはDawnを使用しています。

商品が割引時の場合に◯％OFFと表示させたいです。

price.liquidのコードを追加したのですが反映されませんでした。

追加した箇所は下記の、上段のコードと下段のコードの間に追加しました。

対処法などわかる方いらしたら教えていただきたいです。

〜

{%- endunless -%}  
{{ ‘products.product.price.sale\_price’ | t }}  
  
{{ money\_price }}

{% if current\_variant.compare\_at\_price \> 0 %}  
{% comment %}割引前価格が設定されていればOFF率表記自体する{% endcomment %}  
{% assign float\_compare\_at\_price = current\_variant.compare\_at\_price | times: 1.0 %}  
{% assign per\_sale = current\_variant.price | divided\_by: float\_compare\_at\_price %}  
{% assign float\_per\_off = 1 | minus: per\_sale %}  
{% assign per\_off = float\_per\_off | times: 100 | round %}  
{{ per\_off }}%OFF  
{% endif %}

 {{ 'products.product.price.unit\_price' | t }}  

〜

---

_[View the full topic](https://community.shopify.com/t/off/194886)._
