Member discounts

I need to provide a 20% discount to logged in members when they purchase a product. Support have suggested making all members wholesalers and doing it that way. I think thats going to create other issues (like having to update the CRM when a new member is added via custom module). Has anyone done something similiar? How did you implement it?

I was thinking of running a test on the ecommerce pages and if logged in apply a discount to products but I’m not sure how that will effect the ecommerce processing.

Hi @doodlefish. Yeah, that’s probably how I’d approach it.
Use JS to populate the discount code field at checkout with your 20% code, with some sort of change event on the field - I think you’ll need that for the eCommerce JS to pick it up.
You could hide the discount field too if you wanted to try and keep the discount code ‘secret’.
Use Liquid to only render the JS if logged in so the public can’t snoop for the discount code (as it’ll need to be visible in the JS).

1 Like

I’ve just realised there is another issue. This site has 2 secure zones so I’d need to check which secure zone the user is logged into and only apply the discount if the user is subscribed to the “member” secure zone. Is it possible to test this using liquid?

Yes, you can access the request.currentmember object for a logged in members information:
https://docs.treepl.co/liquid/request-object#secCurrentMember

To check for a particular secure zone could be something like:

{% for sz in request.currentmember.securezones %}
{% if sz.name == 'member' %}
<!-- content here for "member" subscribers -->
{% endif %}
{% endfor %}

(this has not been tested)

Note: For a more robust condition I would check for the secure zone ID rather than its name (in case the name is changed at some point), eg:

...
{% if sz.id == 2 %} <!-- replace '2' with your secure zone ID -->
...

Thanks Adam. Its a bit learning curve for me and I would be lost without your help :1st_place_medal:

1 Like