Skip to content

Commit

Permalink
SHOPBASE-30 Update to only show "Buy Again" button to users who have …
Browse files Browse the repository at this point in the history
…made a purchase and are logged in
  • Loading branch information
ChelseyRiewerTrellis committed Sep 30, 2024
1 parent 6a6679a commit ae4ba74
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
10 changes: 9 additions & 1 deletion sections/main-cart-footer.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@
<button class="button twcss-capitalize twcss-block twcss-mb-8">{{ 'sections.cart.cart_clear' | t }}</button>
</cart-clear-button>
{%- endif -%}
<a href="/account/orders" class="button twcss-capitalize twcss-mb-8">{{ 'sections.cart.buy_again' | t }}</a>
{% assign customer_has_orders = false %}

Check warning on line 32 in sections/main-cart-footer.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

sections/main-cart-footer.liquid#L32

[LiquidTag] Use {% liquid ... %} to write multiple tags
{% if customer %}
{% for order in customer.orders %}
{% assign customer_has_orders = true %}
{% endfor %}
{% if customer_has_orders == true %}
<a href="/account/orders" class="button twcss-capitalize twcss-mb-8">{{ 'sections.cart.buy_again' | t }}</a>
{% endif %}
{% endif %}
{%- endif -%}

<div class="cart__footer isolate section-{{ section.id }}-padding">
Expand Down
10 changes: 9 additions & 1 deletion sections/main-cart-items.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@
{{ 'general.continue_shopping' | t }}
</a>

<a href="/account/orders" class="button twcss-capitalize twcss-mb-8">{{ 'sections.cart.buy_again' | t }}</a>
{% assign customer_has_orders = false %}

Check warning on line 43 in sections/main-cart-items.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

sections/main-cart-items.liquid#L43

[LiquidTag] Use {% liquid ... %} to write multiple tags
{% if customer %}
{% for order in customer.orders %}
{% assign customer_has_orders = true %}
{% endfor %}
{% if customer_has_orders == true %}
<a href="/account/orders" class="button twcss-capitalize twcss-mb-8">{{ 'sections.cart.buy_again' | t }}</a>
{% endif %}
{% endif %}

{%- if shop.customer_accounts_enabled and customer == null -%}
<h2 class="cart__login-title">{{ 'sections.cart.login.title' | t }}</h2>
Expand Down
20 changes: 18 additions & 2 deletions snippets/cart-drawer.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@
{{ 'general.continue_shopping' | t }}
</a>

<a href="/account/orders" class="button twcss-capitalize twcss-mb-8">{{ 'sections.cart.buy_again' | t }}</a>
{% assign customer_has_orders = false %}

Check warning on line 47 in snippets/cart-drawer.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

snippets/cart-drawer.liquid#L47

[LiquidTag] Use {% liquid ... %} to write multiple tags
{% if customer %}
{% for order in customer.orders %}
{% assign customer_has_orders = true %}
{% endfor %}
{% if customer_has_orders == true %}
<a href="/account/orders" class="button twcss-capitalize twcss-mb-8">{{ 'sections.cart.buy_again' | t }}</a>
{% endif %}
{% endif %}

{%- if shop.customer_accounts_enabled and customer == null -%}
<p class="cart__login-title h3">{{ 'sections.cart.login.title' | t }}</p>
Expand Down Expand Up @@ -457,7 +465,15 @@
<button class="underlined-link twcss-underline twcss-capitalize twcss-block twcss-mb-8 twcss-ml-auto">{{ 'sections.cart.cart_clear' | t }}</button>
</cart-clear-button>
{%- endif -%}
<a href="/account/orders" class="button twcss-capitalize twcss-mb-8">{{ 'sections.cart.buy_again' | t }}</a>
{% assign customer_has_orders = false %}

Check warning on line 468 in snippets/cart-drawer.liquid

View workflow job for this annotation

GitHub Actions / Theme Check Report

snippets/cart-drawer.liquid#L468

[LiquidTag] Use {% liquid ... %} to write multiple tags
{% if customer %}
{% for order in customer.orders %}
{% assign customer_has_orders = true %}
{% endfor %}
{% if customer_has_orders == true %}
<a href="/account/orders" class="button twcss-capitalize twcss-mb-8">{{ 'sections.cart.buy_again' | t }}</a>
{% endif %}
{% endif %}
{%- endif -%}

{%- if settings.show_cart_note -%}
Expand Down

0 comments on commit ae4ba74

Please sign in to comment.