$('body').on('click', '[data-product-add-coupon-to-cart] a', function(e) {
   e.preventDefault();

   const $coupon_item = $(this).parents('[data-product-add-coupon-to-cart]');
   if ($coupon_item.length) {
      const url = $coupon_item.data('apply_coupon_url');

      if (url) {
         $(this).addClass('coupon-loading');
         $.ajax(url).done(() => {
            $(this).removeClass('coupon-loading');
            $(this).addClass( "coupon-added" );
         });
      }
   }
});
