How can I create a drawer cart without an app?

Hi all

Im working to create drawer cart .

https://weeklyhow.com/how-to-create-easy-cart-drawers-in-shopify/

With reference of this article And I have managed to open drawer on click to cart icon but I couldnt get cart items .

it seems .

https://shopify.dev/api/ajax/reference/cart#get-locale-cart-js

This step has been changed after article .

I have tried to use fetch(‘/{locale}/cart.js’) instead of fetch(‘/cart.js’) but stil cant see items in drawer.

Im not sure what to check maybe my class id’s can be different than article’s theme .

I will be grateful for any helps.

my shop : https://maxibillionb2c.myshopify.com/

visitor password: flomak

my theme : showcase

An

Hi @nizarsayar ,

You don’t need to change that, just keep ‘/cart.js’, it will work fine.

Please change:

fetch(‘/{locale}/cart.js’)

=>

fetch(‘/cart.js’)

Hope it helps!

1 Like

Hi actually I ve tried without “locale” at first as you said" fetch(‘/cart.js’) " but its not working

Hi @nizarsayar ,

I checked and it’s still ‘{locale}’. Please change it again, I will help you check it

I just changed to" fetch(‘/cart.js’)"

Hi @nizarsayar ,

Please change code here:

theme.Currency.formatMoney(product.line_price, theme.moneyFormat)

=>

theme.Shopify.formatMoney(product.line_price, theme.money_format_with_code_preference)

and

theme.Currency.formatMoney(data.total_price, theme.moneyFormat)

=>

theme.Shopify.formatMoney(data.total_price, theme.money_format_with_code_preference)

Hope it helps!

1 Like

Thanks for your reply I have changed code as below on drawer.liquid

but didnt work for me

Hi @nizarsayar ,

Please change all code:


Hope it helps!

1 Like

Thank you so much! it seems working now. :+1:

1 Like

When I added two items to my cart I can see only the one items . Any idea whats wrong

Hi @nizarsayar ,

Please change code here:

Hope it helps!