0

I have added this JS code inside catalog-add-to-cart.js :

var popup = $('<div class="add-to-cart-dialog ajoutPanierModal"/>').html('<span>Le produit a été ajouté au panier.</span>').modal({
                                modalClass: 'add-to-cart-popup',
                                title: $.mage.__("Produit ajouté"),
                                buttons: [
                                    {
                                        text: 'Continuer mes achats',
                                        click: function () {
                                            this.closeModal();
                                        }
                                    },
                                    {
                                        text: 'Passer la commande',
                                        click: function () {
                                            window.location = "/finalisation/order/finalisation"
                                        }
                                    }
                                ]
                            });
                            popup.modal('openModal');

just after

self.enableAddToCartButton(form);

This is working well. But I've added an observer that check some condition to add into the cart. (with controller_action_predispatch_checkout_cart_add event)

The issue is that : when I click on "add to cart", popup is showing event if the product is not added. Where should I move this popup part ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.