Created
June 3, 2021 23:27
-
-
Save zakhardage/b6aa980d4c2195bad812b40c6a997632 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign member_discount_code = settings.member_discount_code %} | |
{% assign class_discount_code = settings.class_discount_code %} | |
{% assign combined_discount_code = settings.combined_discount_code %} | |
{% if customer %} | |
{% assign customer_tags = customer.tags | join:',' | downcase %} | |
{% if customer_tags contains 'member' %} | |
{% assign member = true %} | |
{% endif %} | |
{% endif %} | |
{% for item in cart.items %} | |
{% if item.product.type == 'class' %} | |
{% assign product_tags = item.product.tags | join:',' | downcase %} | |
{% if product_tags contains [qualifying_product_tag] %} | |
{% assign class_discount = true %} | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
{% if member %} | |
{% if class_discount %} | |
{% assign applied_discount = combined_discount_code %} | |
{% else %} | |
{% assign applied_discount = member_discount_code %} | |
{% endif %} | |
{% else %} | |
{% if class_discount %} | |
{% assign applied_discount = class_discount_code %} | |
{% endif %} | |
{% endif %} | |
<form action="{{ routes.cart_url }}{% if applied_discount != blank %}/?discount={{ applied_discount }}{% endif %}" method="post" novalidate class="cart"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment