Created
December 22, 2017 15:28
-
-
Save krillo/ba649ded28135031b851cad0af14ff42 to your computer and use it in GitHub Desktop.
Magento2 catch ajax complete, add to cart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
require(['jquery'], function ($) { | |
$(document).ajaxComplete(function (event, xhr, settings) { | |
if (settings.url.indexOf("customer/section/load/?sections=cart") > 0) { | |
cartObj = xhr.responseJSON; | |
console.log(cartObj); | |
cartPriceHtml = cartObj.cart.subtotal_excl_tax; | |
$(".cpa-cart-sum-sum").html(cartPriceHtml); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment