Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aelaguiz/7eb7953d375fb5d2e89e to your computer and use it in GitHub Desktop.
Save aelaguiz/7eb7953d375fb5d2e89e to your computer and use it in GitHub Desktop.
<ul class="list-group">
<li class="list-group-item"><h4>Your Subscription(s)</h4></li>
{% set exists = [] %}
{% for sub in customer.subscriptions %}
{% if sub.store_id == store.id %}
{# This makes sure we know if we found a sub tied to the store #}
{% do exists.append(1) %}
<li class="list-group-item">
{% if sub.cart_products %}
<div><strong>{{ sub.cart_products[0].instance.product.name }}</strong></div>
{% if sub.cart_products[0].instance.variants|length == 2 %}
<div>{{ sub.cart_products[0].instance.variants[0].variant_value.value }}</div>
<div>{{ sub.cart_products[0].instance.variants[1].variant_value.value }}</div>
{% endif %}
<div>{{ sub.cart_products[0].price | currency }}</div>
{% endif %}
<div>{{ sub.term.name }}</div>
<div>Status: <strong>{{ sub.status_pretty_string }}</strong></div>
</li>
{% endif %}
{% endfor %}
{% if not exists %}
<li class="list-group-item">No active subscriptions</li>
{% endif %}
</ul>
@coleturner
Copy link

When a subscriber updates their subscription, cart_products retains the old Subscription objects. Is there a way to see which products they changed it to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment