Add current inventory quantity to "Too many items in cart" message

wwwzeroxcentoit
Shopify Partner
6 0 1

Hello,

let's say a customer wants to buy 10 pillows (but we have only 9 in stock)

he adds them to the cart  but when he clicks on the "add to cart" button he gets an alert saying "You can't add more pillows to the cart" 

 

what we'd like would be add to that message the current available quantity, something like

"Unfortunately we only have xxxcurrentquantityinstockxxx left in stock, send us a message if you want to order more"

 

I've tried to add 

{{ current_variant.inventory_quantity }}

to the translation but it doesn't works, what am I doing wrong?

Thanks for you help

Tejas_Nadpara
Shopify Partner
1034 215 511

@wwwzeroxcentoit 

 

Ok, I understood your goal. Please send me your store url so I can check and assist you better.

 

Thank you,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
0 Likes
wwwzeroxcentoit
Shopify Partner
6 0 1
www.sanstabu.com

psw woosao

thanks
0 Likes

Can you provide product URL to better look at this issue?

CRO Expert at PageFly - Advanced Shopify Page Builder - Empowering 90.000+ active merchants.

Check our Evergreen Guide on Moving Your Brick-n-Mortar Store Online.

Want To Strive The Coolest E-commerce Knowledge? Explore Our FREE Video Resources.

0 Likes
wwwzeroxcentoit
Shopify Partner
6 0 1
https://www.sanstabu.com/products/cushion-love-in-silk-sunlight-red-eros-ludic-sans-tabu

psw woosao

of you add 10 cushions to the cart you"ll see the message i'd like to change

thanks
0 Likes

Open file halo.js inside your assets folder of your theme and go to line 2915 change the code to

// Old
$('.ajax-error-message').text($.parseJSON(xhr.responseText).description);

// New
$('.ajax-error-message').text('your_message_that_you_want_to_edit');

CRO Expert at PageFly - Advanced Shopify Page Builder - Empowering 90.000+ active merchants.

Check our Evergreen Guide on Moving Your Brick-n-Mortar Store Online.

Want To Strive The Coolest E-commerce Knowledge? Explore Our FREE Video Resources.

0 Likes
wwwzeroxcentoit
Shopify Partner
6 0 1
Thankyou very much for your help but it's not what I was looking for...

when you get the error message I'd like to show the current available
quantity in stock, something like "you can't add more items to your cart
because we only have xxx in stock" ... xxx should be the current available
quantity in stock

I've tried using {{ current_variant.inventory_quantity }} but it doesn't
works

do you know what's the right variable?

Thanks
0 Likes
esribeiro
New Member
1 0 0

Hi, did you find out how to do it? I'm looking for the same. Thanks!

0 Likes
Ianthegardenguy
Tourist
5 0 2

Hi!

I would also find this very useful for shopify website as well.  Using debut theme.  Is there any language i can add to  "checkout & system notices" in cart section of theme language or do i need to tweak the code files?

 

Any help would be greatly appreciated.

Ian

ninabayandco
New Member
1 0 0

Did you ever get a resolution? I'm looking to do the same thing.

0 Likes