Hi @gab33
Your function to disable the pay buttons like Google and Apple pay is extremely helpful, so thank you!
However, I do have a small issue. I copied your code exactly into my template (I am using the theme Debut), but the pay buttons stay greyed out and unclickable even after selecting the checkbox.
What am I doing wrong?
Cart-template.liquid:
<input type="submit" name="checkout"
class="cart__submit btn btn--small-wide"
value="{{ 'cart.general.checkout' | t }}">
</div>
<p style="float: none; text-align: right; clear: both; margin: 10px 0;">
<input style="float:none; vertical-align: middle;" type="checkbox" id="agree" />
<label style="display:inline; float:none" for="agree">
Ik ga akkoord met de <a href="/policies/terms-of-service"><strong>algemene voorwaarden</strong></a>.
</label>
</p>
<div class="cart__error-message-wrapper hide" role="alert" data-cart-error-message-wrapper>
<span class="visually-hidden">{{ 'general.accessibility.error' | t }} </span>
{% include 'icon-error' %}
<span class="cart__error-message" data-cart-error-message></span>
</div>
{%- if additional_checkout_buttons -%}
<div id="additional-buttons-c" class="additional-checkout-buttons">{{ content_for_additional_checkout_buttons }}</div>
{%- endif -%}
</div>
</div>
</div>
</div>
theme.scss.liquid:
}
.div-disabled {
pointer-events: none;
opacity: 0.4;
}
theme.js:
}
$("#additional-buttons-c").addClass("div-disabled");
$(document).ready(function() {
$('body').on('click', '[name="agree"]', function() {
if ($('#agree').is(':checked')) {
$("#additional-buttons-c").removeClass("div-disabled");
}
else {
$("#additional-buttons-c").addClass("div-disabled");
}
});
});
$(theme.init);
$(document).ready(function() {
$('body').on('click', '[name="checkout"], [name="goto_pp"], [name="goto_gc"]', function() {
if ($('#agree').is(':checked')) {
$(this).submit();
}
else {
alert("Om de bestelling te kunnen plaatsen dien je akkoord te gaan met de algemene voorwaarden");
return false;
}
});
});
Hello -thank you doe this! So I am using Brooklyn theme. I completed your steps, "however" since your post of 2019 - perhaps the code changed a little?
this code doesn't appear to be the same anymore
theme.checkoutIndicator();
I WAS able to add a check box at checkout - it says: I agree with the terms and conditions. BUT - it still allows users to click on CHECKOUT without clicking the box
If you can update this line of code, that would be awesome!!!
Hi There. This wasn't my original post. My input here is from the last few weeks
Hmmmm I am not sure what else to tell you. I wish I had something. I would try and add the // again and make sure you save it.
I somehow got mine to work. Maybe you can post a new thread? Best of luck. Sorry I can't help further.
This is what my code section looks like:
theme.checkoutIndicator = function() {
// Add a loading indicator on the cart checkout button (/cart and drawer)
theme.cache.$body.on('click', '.cart__checkout', function() {
$(this).addClass('btn--loading');
});
};
Hello - not sure if you are asking me or@gab33 ? This is not my original post.
I would ask @gab33
Wish I could assist but I don't know the answers to your questions. I am not a developer or a guru. I used the code for my brooklyn theme and it worked.
https://goddessswag.com if you want to see my checkout set up.
User | Count |
---|---|
542 | |
209 | |
126 | |
80 | |
44 |