GithubHelp home page GithubHelp logo

Comments (14)

edoardolunardi avatar edoardolunardi commented on September 2, 2024 1

@EvgeniyMukhamedjanov thanks for the support.
I will proceed this way:

  1. run a dev store with the dawn theme, install that culprit app, and see if it works with the default cart drawer
  2. if no, then it's definitely an issue with the app
  3. if yes, I will install my theme with the ajax cart on the dev store + the app so you can have a quick look

My goal would be to stick with the ajax cart since it abstracts logic away that otherwise I would need to implement manually, but I need to make sure it's not gonna break when the client adds apps that can modify whatever is in the cart.

I will keep you posted! Thank you.

from liquid-ajax-cart.

edoardolunardi avatar edoardolunardi commented on September 2, 2024 1

Hey @EvgeniyMukhamedjanov, the free gifts app works with the default dawn theme ajax cart, this means something is off in the liquid-ajax-cart library. I coded my custom ajax cart in the end. This can be closed 👍. Thanks for the support!

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on September 2, 2024

@edoardolunardi
Obviously you don't have a section with the "sections_url" name on your website. So we need to understand why Liquid Ajax Cart tries to request the "sections_url" section.
Liquid Ajax Cart gets the sections names from the DOM by looking within parents of data-ajax-cart-section elements in order to find a parent with the id that starts with "shopify-section-". Everything that goes after "shopify-section-" will be the name of the shopify section.
Can you check if you have elements in your DOM with the "shopify-section-section_url" id?
Also can you take a screenshot of the DOM with all the parents of the "data-ajax-cart-section" element? Something like this:
image
I need to see the cart's "data-ajax-cart-section" element and its parent with id="shopify-section-..."

from liquid-ajax-cart.

edoardolunardi avatar edoardolunardi commented on September 2, 2024

Hey @EvgeniyMukhamedjanov, thanks for looking into this.
There's no element in the dom containing section_url or sections_url as id or class.
Here's a screenshot with the parents of the data-ajax-cart-section

Screenshot 2024-03-26 at 08 46 22

from liquid-ajax-cart.

edoardolunardi avatar edoardolunardi commented on September 2, 2024

Hey @EvgeniyMukhamedjanov, sorry to bug you, did you have another change to take a look? 🙏

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on September 2, 2024

Hi @edoardolunardi.
Yeah, I was trying to replicate the issues with no success.
I remember you mentioned the project is under NDA but maybe you have a chance to replicate this issue on a test store without disclosure any clients information?
Or maybe you could provide the steps to replicate the issue?
It is important to find this bug for me as well, as we use the lib on a lot of prod stores :-)

from liquid-ajax-cart.

edoardolunardi avatar edoardolunardi commented on September 2, 2024

Hey @EvgeniyMukhamedjanov, after banging my head on this for hours and hours, I finally realized the culprit is an app, in my case this one https://apps.shopify.com/freegifts. This app is adding some products to the cart automatically, and somehow it messes up the ajax cart. Still not sure how I'm gonna approach this with the client, in the meantime, does it ring any bell? Thank you!

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on September 2, 2024

@edoardolunardi
I think in this case it is easier either to get back to the Dawn ajax cart implementation and continue using this app
or build the BOGO promo by yourself if the app isn't a request from the client.

Basically Liquid Ajax Cart has methods to build any kind of automatic adding/removing items to/from the cart. You just need to add some fields for the client where they will be able to chose which product is a gift. Also the discount set up will be on you as well.

If you decide to use Liquid Ajax Cart API to automatically add/remove items then check this doc:
https://liquid-ajax-cart.js.org/v2/cart-mutations/

from liquid-ajax-cart.

edoardolunardi avatar edoardolunardi commented on September 2, 2024

Thanks @EvgeniyMukhamedjanov! Out of curiosity, do you have any idea why that app might cause issues with the ajax cart? The client is gonna have one app doing cart upselling as well as showing bundles in the cart when a specific product is added, is there a change this app will also mess it up?

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on September 2, 2024

@edoardolunardi
Most likely this app intercepts all the ajax requests and change them somehow. And it is understandable, as they need to understand somehow all the cart changes made by a user. I checked it on their demo site, and I see that a simple ajax add to cart goes through this app:
image

Most likely you'll see a trace of this app within each cart ajax request as well on your website.

Unfortunately I don't see any dev doc that explains how to change the app behavior.

Actually why did you decide using Liquid Ajax Cart on your project? Do you have a lot of cart customization?

from liquid-ajax-cart.

edoardolunardi avatar edoardolunardi commented on September 2, 2024

Yeah that makes sense.
Actually yes, the cart is gonna have quite some customization, specifically, upselling based on products in the cart. For example, if there's a product with selling plans, and the user added just the one time purchase, the upsell will tell that a subscription is better. Or another use case, if the user has specific products in the cart, the upsell will tell that adding another one will make you save money etc.. so yes, a lot of customization I would say. Since I'm developing a theme, this logic should be offloaded to the backend.

So at this point it sounds like the ajax cart is not really suitable for these cases correct? (assuming the theme offloads all the cart logic to the backend through apps).

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on September 2, 2024

@edoardolunardi
Actually the Liquid Ajax Cart might be not suitable only because the apps, that you use, have frontend customizations. If the customizations were backend only, then it wouldn't be an issue.

But now I see that the gift app modifies the behavior of frontend requests and if you must use the apps, then you have no choice I guess.

from liquid-ajax-cart.

edoardolunardi avatar edoardolunardi commented on September 2, 2024

@EvgeniyMukhamedjanov thanks, then I guess I have no choice but remove the liquid-ajax-cart :/
I plan to build my own ajax cart https://shopify.dev/docs/api/ajax/reference/cart, but I wonder: isn't this what liquid-ajax-cart is doing under the hood? Do you think I might run into the same issues then?

from liquid-ajax-cart.

EvgeniyMukhamedjanov avatar EvgeniyMukhamedjanov commented on September 2, 2024

@edoardolunardi
Yes, Liquid Ajax Cart is just a wrapper for the Shopify Cart API your mentioned.

But in addition to that it automatically scans all the sections on the page that should be updated after each request (data-ajax-cart-section) and modifies the request to also ask Shopify to return updated HTML for those sections using this API:
https://shopify.dev/docs/api/ajax/reference/cart#bundled-section-rendering (If you are going to build your own ajax-cart, you'll need this as well)

Also Liquid Ajax Cart provides ready components for product add-to-cart form, qty controls etc.

So for me it is difficult to say at what point the gift app conflicts with the Liquid Ajax Cart logic and I can't guarantee that you won't face the same issue unfortunately.

Do you have any website with the gift app install and liquid ajax cart installed? Maybe a dev website that you can share? I would be able at least find the reason.

Also did you try contacting the app developers? Sometimes they might check why the issue happening and suggest a fix or fix it by themselves?

from liquid-ajax-cart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.