I’m wondering what the best way to manipulate/override ‘add to cart’ buttons is? In general, for buttons, what is the best way to override the ‘onclick’ method?
Is there a way I can grab the global cart/session object in order to manipulate it?
We have played around with this! I have attached some experimental code that we started. Maybe it’s a starting point for you. You could trigger the cart to add it’s ‘.show’ class? @neueMeta any ideas?
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<script>
$(document).ready(function() {
$('[data-id="PASTE WIDEGET ID HERE"]').click(function() {
$('#cart-sidebar').toggleClass("show");
});
});
$(".e-com-cart-button > div > div").clone().appendTo("#MAYBE YOU COULD APPEND THE CART NUMBER TO ANOTHER ELEMENT?");
</script>
well, what exactly do you want to achieve/change… it might be possible to change behaviour/naming/whatsoever. I´m not that into e-commerce integration and don´t have a project where I can check things out right now but I can give tipps on how to approach a change in the default behaviour/etc…
Hi, so tbh I don’t know what I can do yet. Headless.Horse’s answer was enough. I just needed an object for me to log to console and inspect, that I way I can see what I can do (or not do).
In the end we may have to just build or own backend using the Stripe client library and integrate with that somehow.
I’d like to close this case now, but don’t know how!