Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: 422 Unprocessable Content when adding Bundle with Expand to cart

422 Unprocessable Content when adding Bundle with Expand to cart

AV_SL
Shopify Partner
40 4 16

I'm getting intermittent 422 Unprocessable Content errors on Merchants stores when adding bundle products to cart that run Expand. There's no reliable way to replicate the error, and the payloads for successful and non successful calls are exactly the same.

Example payload that caused 422

 

 

form_type: product
utf8: ✓
id: 44061997924507
product-id: 7853945389211
section-id: template--16459352408219__main
properties[_bundleId]: KPVA-44061997924507
properties[_selectedItems]: [{"i":"44061751312539","q":1,"s":1},{"i":"44061795254427","q":1,"s":1},{"i":"44061783949467","q":1,"s":1}]
quantity: 1
sections: cart-notification-product,cart-notification-button,cart-icon-bubble
sections_url: /products/product-handle

 

 

Response:

 

 

{
    "status": 422,
    "message": "Cart Error",
    "description": "All 0 {product name} are in your cart."
}

 

 

 

The bundle does successfully add to cart which and shows a success in Functions logs, but the user (and the merchant) is presented with a storefront error - which is a huge issue for public apps.

Is this a bug?

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.
Replies 15 (15)

SBD_
Shopify Staff
1831 273 423

Hey @AV_SL 

 

Thanks for flagging this - checking with the Functions team and will report back.

Scott | Developer Advocate @ Shopify 

AV_SL
Shopify Partner
40 4 16

Really appreciate it! @SBD_ 

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.
AV_SL
Shopify Partner
40 4 16

@SBD_ We were able to replicate this again temporarily today.

 

  • Again, the bundle product adds to cart but returns the same 422 error consistently "All 0 {product name} are in your cart.".
  • When trying to remove the bundle product from cart, another 422 error flags  "The {product name} cannot be added to cart".
  • If I go to /cart/clear to clear the cart, the product begins functioning again.
  • Once the error appears, it continuously appears for that product until the cart is cleared with /clear
  • The error does not appear for other products (bundle or standard) that in the cart, or being added to the cart, when an error prone product is already in cart, or experiencing issues.

Perhaps this is related to a bug that appears in cart, in a very specific instance - though we haven't been able to find exactly what that instance is.

It honestly seems entirely random, given we had been adding this particular product to cart without issue for hours while working on other things.

 

Data below - I also have links to the successful Functions that ran at this time if you need.

 

Updated payloads with the error if they help at all...

quantity=1&form_type=product&utf8=%E2%9C%93&id=42780378267839&product-id=7639960617151&section-id=template--16531935264959__main&properties%5B_bundleId%5D=ZXCX-42780378267839&properties%5B_selectedItems%5D=%5B%7B%22i%22%3A%2242656949600447%22%2C%22q%22%3A1%2C%22s%22%3A1%7D%2C%7B%22i%22%3A%2242656949272767%22%2C%22q%22%3A1%2C%22s%22%3A2%7D%5D

parsed:

quantity: 1
form_type: product
utf8: ✓
id: 42780378267839
product-id: 7639960617151
section-id: template--16531935264959__main
properties[_bundleId]: ZXCX-42780378267839
properties[_selectedItems]: [{"i":"42656949600447","q":1,"s":1},{"i":"42656949272767","q":1,"s":2}]

and how Pipeline (the theme in today's error) submits the form:

addToCart(formData) {
          const url = `${window.theme.routes.cart}/add.js`;
          const formPayload = new URLSearchParams(formData).toString();

          return axios.post(url, formPayload, {
            headers: {
              'X-Requested-With': 'XMLHttpRequest',
              'Content-Type': 'application/x-www-form-urlencoded',
            },
          });
        },

 Previously themes showing the error were Dawn and Crave so I don't believe it's theme related.

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.
SBD_
Shopify Staff
1831 273 423

Thanks for all the details @AV_SL - they think this might be related to a recent rollout and are investigating.

Scott | Developer Advocate @ Shopify 

AV_SL
Shopify Partner
40 4 16

Hi @SBD_  - any developments on this issue? We've had another couple merchants stores returning the same issue randomly.

Thanks! Any update is much appreciated.

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.
SBD_
Shopify Staff
1831 273 423

Hey @AV_SL 

 

Looks like it's still under investigation. Have pinged the team with a follow up. Will let you know as soon as I hear back.

Scott | Developer Advocate @ Shopify 

AV_SL
Shopify Partner
40 4 16

Hi @SBD_ 

Hate to be the squeaky wheel on this - but we've just had another merchant using our app experience this issue. Is there an update on this issue?

Thanks

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.
SBD_
Shopify Staff
1831 273 423

Hey @AV_SL 

 

Thanks for checking in. It's moved over to the Cart team. I've just asked them for an updated and should hear back overnight.

Scott | Developer Advocate @ Shopify 

AV_SL
Shopify Partner
40 4 16

Really appreciate it @SBD_  Thanks!

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.
prakhar96
Shopify Partner
2 1 2

Hi @SBD_

Thank you so much for your responses. 
But we have also faced this issue from our merchants. 

 

It feels like a bad excuse to tell that Shopify is looking into it. Haha!

 

It breaks down the merchant's confidence as well when they get to know that it's been 2 months so they might not get a fix for a long time. 

 

Is there any update for this?

SPEAZ
Shopify Partner
31 3 17

Hi @SBD_ 

Any news regarding this ? seems it's still ocurring randomly on some merchant store 

teemukostamo
Shopify Partner
7 1 12

Hi! I'm following along the customized bundles  tutorial and get the same error. I've created the bundle product along with the components.

 

If I add the bundle product to cart I get : 422 "The bundle product '{product_name}' cannot be added to the cart."

Subsequent attempts result to: 422 "All 0 {product_name} are in the cart"

 

If I then add a regular product to cart and attempt checkout, I get "Inventory issues - my bundled item is sold out" on the checkout page.

 

Just curious if I'm doing something wrong or if it's an issue with the functions api.

DevAOC
Shopify Partner
5 0 6

I'm getting this exact same issue.. Any luck getting it to work? I've tried modifying the bundle product's variant with inventory, changing the inventory policy to "CONTINUE" and updating the child products with no success

Brandinator98
Shopify Partner
1 0 0

Same here, are there any updates on this? Can't add a custom bundle to cart. Worked fine in a Dev Store, but breaks in a live store with the new checkout

mleimbach
Shopify Partner
7 0 5

@SBD_  this issue still occurs on some of our stores, has there been a fix on this and will there be a fix on this before the checkout migration deadline ?
we can not add custom bundles to the cart and we are getting this error.

-> we have to upgrade stores to the new custom bundle feature cause we also have to upgrade the checkout. (our alternations require this.)
and we get this error on some of the required stores them.

we need this functioning before we can perform the checkout migrahtions on some stores so the urgency is pretty high here.

Matthias Leimbach
Lead Development

beeclever
Koblenz, Germany