Add simulate cart hooks

This commit is contained in:
Pedro Silva 2023-10-12 18:22:55 +01:00
parent 6f6b3ac1c1
commit b29da6a627
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
3 changed files with 21 additions and 3 deletions

View file

@ -17,7 +17,7 @@ class SingleProductBootstap {
this.formSelector = 'form.cart';
// Prevent simulate cart being called too many times in a burst.
this.simulateCartThrottled = throttle(this.simulateCart, 5000);
this.simulateCartThrottled = throttle(this.simulateCart, this.gateway.simulate_cart.throttling || 5000);
this.renderer.onButtonsInit(this.gateway.button.wrapper, () => {
this.handleChange();
@ -217,6 +217,11 @@ class SingleProductBootstap {
}
simulateCart() {
// Check of cart simulation is enabled.
if (!this.gateway.simulate_cart.enabled) {
return;
}
const actionHandler = new SingleProductActionHandler(
null,
null,