EvgeniyMukhamedjanov / liquid-ajax-cart

Build a Shopify Ajax-cart without JavaScript coding
https://liquid-ajax-cart.js.org
194 stars 22 forks source link

Liquid Ajax Cart: the HTML for the "ajax-cart-section" section was requested but the response is null #26

Closed franjuju closed 2 years ago

franjuju commented 2 years ago

Hi,

First, thank you for this really useful library. I'm using it since a while on my Shopify website but when I switch from version 1.6 to 1.10.2 I face an issue.

I've obviously read multiple times the installation guide to be sure that I've checked all the steps. However, everytime I add a product to the cart or update the cart, I have this weird error in the console 'Liquid Ajax Cart: the HTML for the "ajax-cart-section" section was requested but the response is null'. I've tried a lot of things to spot what is the problem but I can't find what is the problem.

Here is my code from the theme.liquid

` {% section 'cart-drawer' %}

`

And my cart-drawer section

Capture Capture-2

EvgeniyMukhamedjanov commented 2 years ago

Hi, Thank you for using Liquid Ajax Cart.

You see this error because you have id="shopify-section-ajax-cart-section" in your code. I'm not sure why you need this id but its stucture exaclty matches the Shopify sections ids: shopify-section-[section-name] (you can check any section id, that is generated by shopify, it will have the same stuctured id) .

So Liquid Ajax Cart "thinks" that your manual id="shopify-section-ajax-cart-section" is also a Shopify section wrapper and tries to request an HTML for the "ajax-cart-section" (shopify-section-ajax-cart-section) section that doesn't exist.

In order to fix this issue try to avoid using manual ids that begin with "shopify-section-".

franjuju commented 2 years ago

Amazing! Thank you very much, this fixed my issue!