URGENT!! PLEASE HELP!! Shopping Cart Error (Theme Support Please help)

New Member
7 0 0

Hi , I have recently got an error message when I try to add product to the cart. The message is something like "there was an error while updating cart, please try again later", I also have similar problem when I tried to remove products in my shopping cart. This error happens from time to time, without any reason ( i haven't changed any code at all, and I also tried to remove all the installed apps, and the reinstall them back for many many times, and seems nothing works)

The error sometimes appear on mobile version and sometimes on desktop versions, and sometimes on both. This is very frustrating, and I have tried all the way I could.  My URL is mamy-kingdom.myshopify.com.  

 

I got a reply from a helper saying that there is something wrong with my product form js event. Below is his suggestion. Please could anyone help on this? Thanks you very much in advance.

=================================================================================

There is something wrong with your product form js event. It's not parsing JSON properly. 
When I see the console. POST url is wrong and throws 400 Error, It shows XHR request as follows, 

 

XHR failed loading: POST "https://www.mamy-kingdom.com/collections/%E6%AF%8D%E5%AC%B0%E7%94%A8%E5%93%81/products/[object%20Object]".n.send @ shop_events_listener-09875a9a2b286acf534498184c24b199675a6097a941992d0979e5295d2cf9e9.js:1send @ jquery-1.11.0.min.js:4ajax @ jquery-1.11.0.min.js:4n.<computed> @ jquery-1.11.0.min.js:4_addItemToCart @ theme.js?685:4205
(anonymous) @ theme.js?685:4191dispatch @ vendor.js?685:14g.handle @ vendor.js?685:14

you see [object%20Object] .. It's not parsing JSON properly. 

Problem lies here, in theme.js

 

_addItemToCart: function(data) {
      var params = {        url: '/cart/add.js',        data: $(data).serialize(),        dataType: 'json'
      };      $.post(params)
        .done(
          function(item) {
            this._hideErrorMessage();
            this._setupCartPopup(item);
          }.bind(this)
        )
        .fail(
          function(response) {
            this.$previouslyFocusedElement.focus();
            var errorMessage = response.responseJSON
              ? response.responseJSON.description
              : theme.strings.cartError;
            this._showErrorMessage(errorMessage);
            this._handleButtonLoadingState(false);
          }.bind(this)
        );
    },

I recommend contacting theme support and ask them about it and if your theme is outdated, try updating it. 

 

=================================================================================

0 Likes