Shopify / js-buy-sdk

The JS Buy SDK is a lightweight library that allows you to build ecommerce into any website. It is based on Shopify's API and provides the ability to retrieve products and collections from your shop, add products to a cart, and checkout.

Home Page:https://shopify.github.io/js-buy-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

500 Error Graphql - Buy One Get One Discount breaks cart

shawngrona opened this issue · comments

Bug details

Describe the bug
Shopify Buy One Get One discount breaks cart functionality.

Steps to reproduce:

  1. Create a collection listing all products example
  2. Create a Buy One Get One Discount example
  3. Using this example code in react-js-buy folder, add a product that is part of the Buy One Get One discount (eg "Foundations in MDMA Safety, Therapeutic Applications & Research") to cart multiple times

Expected:

Cart should show line items with quantity.

You should be able to add or remove the line items from cart.

Actual:

Strange presentation in the cart with same variant split into multiple line items.

You're unable to remove line items from the cart which are involved in the BOGO discount. 500 error from the graphql endpoint for example:

index.js:4078 Uncaught (in promise) Error: [{"message":"Internal error. Looks like something went wrong on our end.\nRequest ID: 9ef6a61e-3635-4426-b263-b7c59582e46f (include this in support requests).","extensions":{"code":"INTERNAL_SERVER_ERROR","requestId":"9ef6a61e-3635-4426-b263-b7c59582e46f"}}]

Code Example:
Here is a minimum reproducible example code based off of the storefront-api-examples repo

Video Example:
Here is a Loom video which demonstrates the issue

Environment (please complete the following information):

  • OS: Mac
  • Browser Chrome, Safari, Any
  • SDK Version 2.17.1

Additional context
Here is a minimum reproducible example code based off of the storefront-api-examples repo

Bug Report Checklist

  • I have read and agree to the CODE_OF_CONDUCT.md
  • I have read the CONTRIBUTING.md guidelines.
  • I have provided a detailed description of the bug, including code samples, and/or network data.
  • I have provided information about my development environment, including SDK version.
commented

Same issue here with Cart + Discount code applied after I tried to remove line item from cart. Any help?

Thanks @whitesunset. I opened a support ticket by requesting a callback, sat on hold for half an hour, they said they'd get back to me ticket 34237990.

I expect this will take a while to get shopify to own this issue... i got significant pushback about this being "a third party theme and not their issue" while escalating through support.

i'll follow up here as i follow up on that ticket

Shopify support still telling to contact the third party theme developer. Very frustrating to receive this level of support, we've paid shopify a lot of money over the years - they get a cut of every sale.

Anyone reading these github issues?

Opened another issue over here in Shopify community land

Same issue here with Cart + Discount code applied after I tried to remove line item from cart. Any help?

We are seeing the same issue when trying to remove a lineItem from the cart (when it happens to be the last line item left in. the cart)

We are seeing this error in gatsby

Screen Shot 2022-11-25 at 12 18 25 PM

I'm seeing a similar 500 error when trying to use removeLineItems with a line item that has an automatic discount (amount off products).

I'm sure most people have figured this out already but I have had to switch from removeLineItem to updateLineItems with a quantity of 0

Hey @shawngrona a fix was deployed for the problem with checkoutLineItemsRemove please let me know if you continue to experience the issue.

commented

@johncraigcole

As a late confirmation:
It was resolved for us. Thanks a lot for the fix!