 
       self.getCartData()
 
-      $(window).on 'cartUpdated', ->
-        self.getCartData()
+      $(window).on 'cartUpdated', (event, cartData) ->
+        if (cartData)
+          self.setCartData(cartData)
+        else
+          self.getCartData()
 
       $('.amount-items-in-cart, .show-minicart-on-hover').mouseover ->
         $(window).trigger 'miniCartMouseOver'

        $(self.options.$template).removeClass 'amount-items-in-cart-loading'

      promise.success (data) ->
        amountProducts = data.items.length
        amountItems = 0;
        amountItems += item.quantity for item in data.items
        totalCart = self.formatCurrency data.value

        self.selectors.amountProducts.html amountProducts
        self.selectors.amountItems.html amountItems
        self.selectors.totalCart.html totalCart

      promise.fail (jqXHR, textStatus, errorThrown) ->
        console.log 'Error Message: ' + textStatus;
        console.log 'HTTP Error: ' + errorThrown;

      promise

    $.fn[pluginName] = (options) ->
      @each ->

        num = value / 100
      parseFloat(num).toFixed(2).replace('.', ',').toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1.')

    getCartData: ->
      self = this

      $(self.options.$template).addClass 'amount-items-in-cart-loading'
