The membership object

To use the membership object liquid drop, the WooCommerce Memberships integration must be active on your site. You can read more about the integration here.

Property Liquid Description Data type
plan name {{ membership.plan_name }} Plan name for membership
Output: Gold membership
string
members area url {{ membership.view_url }} Link to the members area for membership
Output: http://mysite.com/members-area/161/
string
start date1 {{ membership.start_date }} Date the membership started string
end date1 {{ membership.end_date }} Date the membership ends string
paused date1 {{ membership.paused_date }} Date the membership was paused string
cancelled date1 {{ membership.cancelled_date }} Date the membership was cancelled string
created date1 {{ membership.date_created }} Date the membership was created string
product {{ membership.product }} Product purchased to gain access (see product object) object

1 Date filter should be applied — a good default is to use {{ date | date: "%B %e, %Y" }}, outputs something like: September 1, 2018.

Examples

Only include a renewal section for memberships that were purchased

{% if membership.product %}
  <p>Ready to renew your membership? You can click here to extend it!</p>
  <a href="{{ membership.product.url }}" class="button" style="color:#fff;background:#000;">Buy {{ membership.product.title }}</a>
{% else %}
  <p>This membership can't be renewed. Get in touch with our team if you'd like an extension!</p>
  <a href="mailto:my@email.com">Get in touch</a>
{% endif %}

Change text based on product that was purchased

{% if 'Sponsorship' == membership.product.title %}
  <p>We really appreciated your sponsorship this year! We'd love to talk about extending our relationship. Could you reply to set up a time to chat?</p>
{% endif %}

Change text based on start date

{% assign start_date = membership.start_date | date: '%s' %}
{% assign cutoff = 'June 1, 2018' | date: '%s' %}

{% if start_date > cutoff %}
  <p>Ready to renew your membership? You can click here to extend it!</p>
  <a href="{{ membership.product.url }}" class="button" style="color:#fff;background:#000;">Buy {{ membership.product.title }}</a>
{% else %}
  <p>Great news! Members who purchased this spring get a discount on their next renewal. You can use this discount code to extend your membership:</p>
  <p><code>ABCD-1234-ZYXW</code></p>
  <a href="{{ membership.product.url }}" class="button" style="color:#fff;background:#000;">Buy {{ membership.product.title }}</a>
{% endif %}