I have looked into the "checkbox to agree to terms" solution to adapt it for my purpose; with no luck.
The challenge I am having is I always get "real time data is no"...even when I debug in cart and display {{ RTdata }} (output is 'Yes')...with the following code:
I have cart.liquid, i set the variable RTdata to 'no' unless they buy certain products.
{% assign RTdata = 'No' %}
[[then {% for item in cart.items %}, but before i close it, i add this code looking for if they bought certain products ]]
{% if item.product.title contains 'placeholder-data' %}
{% assign RTdata = 'Yes' %}
{% endif %}
in theme.js.liquid, i added this before the end
$(document).ready(function() {
$('body').on('click', '[name="checkout"], [name="goto_pp"], [name="goto_gc"]', function() {
{% if RTdata == 'Yes' %}
alert("Real Time data is Yes");
{% else %}
alert("Real Time data is No");
{% endif %}
});
});
I always get "real time data is no"...even when I debug in cart and display {{ RTdata }} (output is 'Yes')
What am I doing wrong?
User | Count |
---|---|
395 | |
202 | |
146 | |
42 | |
39 |