Skip to content

Commit

Permalink
discounted prices in drop down selector menu now have strikethrough e…
Browse files Browse the repository at this point in the history
…ffect
  • Loading branch information
Moggach committed Jul 15, 2024
1 parent 1ef9954 commit 4c62cff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/templates/app/includes/cart_options.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
{% if variant.title != "Default Title" %}{{ variant.title }} -{% endif %}
{% money_localize variant.price "GBP" %}
{% if variant.compare_at_price is not None %}
<s>{% money_localize variant.compare_at_price "GBP" %}</s>
{% money_localize variant.compare_at_price "GBP" as localized_compare_price %}
{{ localized_compare_price|strikethrough }}
{% endif %}
</option>
{% endfor %}
Expand Down
5 changes: 5 additions & 0 deletions app/templatetags/books.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ def get_books(since=None, types=None, limit=None):
@register.simple_tag
def get_merch():
return MerchandisePage.objects.live().public()

@register.filter(name='strikethrough')
def strikethrough(text):
"""Convert text to strikethrough using Unicode characters."""
return ''.join(char + '\u0336' for char in str(text))

0 comments on commit 4c62cff

Please sign in to comment.