I18n Error: Missing interpolation value "savings" for "You're saving {{ savings }}"

Highlighted
New Member
1 0 1

Hello All,

 

I am getting this error in the discount section on the mini cart page when I add the product in my cart. Instead of displaying the calculated discount, my store cart throws this error: " I18n Error: Missing interpolation value "savings" for "You're saving {{ savings }}" ". I got this error after creating rule for Automated Discount from shopify admin store. Please check the attached screenshot for the detail issue.

 

Can you please provide any solution to get fix my issue on the ajax cart.

 

Please suggest me with the solution to getting fix my issue.

 

Thanks in advance!

 

shopify cart issue.jpg

 

1 Like
Highlighted
Tourist
5 0 2

Same issue noticed sprung up in my shop too.

0 Likes
Highlighted
Tourist
5 0 2

Noticed this occurs when i have an automatic discount configured and an item which is eligible in the cart...i turned off my automatic discount because was just testing 'to fix' and have not yet pursued permanent solution.

 

Note: Using Brooklyn Theme 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
4 0 4

You can try looking for the code in your theme.js.liquid file:

 

totalCartDiscount: cart.total_discount === 0 ? 0 : {{ 'cart.general.savings_html' | t: price: '[savings]' | json }}.replace('[savings]', theme.Currency.formatMoney(cart.total_discount, settings.moneyFormat))

 

and change the  t: price: to t: savings:

 

Make sure to test it out with a demo promotion to ensure the savings are the correct amount.

0 Likes
Highlighted
Tourist
5 0 2

My theme.js looks a little different, any insight in how to modify this. Thanks

 // Gather all cart data and add to DOM
    data = {
      items: items,
      note: cart.note,
      totalPrice: theme.Currency.formatMoney(
        cart.total_price,
        settings.moneyFormat
      ),
      totalCartDiscount:
        cart.total_discount === 0
          ? 0
          : theme.strings.cartSavings.replace(
              '[savings]',
              theme.Currency.formatMoney(
                cart.total_discount,
                settings.moneyFormat
              )
            )
    };
0 Likes
Highlighted
Shopify Staff
Shopify Staff
4 0 4

Hi there,

 

So on newer version of Brooklyn that have this error you need to locate this in the theme.liquid file,  and similarly change

 

cartSavings: {{ 'cart.general.savings_html' | t: price: '[savings]' | json }}


to

 

cartSavings: {{ 'cart.general.savings_html' | t: savings: '[savings]' | json }}

 

3 Likes
Highlighted
Tourist
5 0 2

Thanks for the follow-up, this appears to have fixed my issue. Thanks again.

1 Like
Highlighted
New Member
2 0 1

It worked for me too. Thank you!

1 Like
Highlighted
Tourist
7 0 0

Sorry to bring this up but I have been searching everywhere and none of the answers to solve this are available in my theme. We are using Digital world and in the theme.liquid there is no cartSavings. It must be somewhere else but I can't seem to find it. If you have any ideas I would greatly appreciate it. I know it is for adding the discount but can't solve this issue and its hurting our purchasingdownload.png

0 Likes
Highlighted
Shopify Staff
Shopify Staff
4 0 4
Hi David, I'm assume Digital World is a third party theme? In which case
it would be best to try contacting the theme developer for assistance.

You could also try searching through the theme.liquid and .js files for any
reference to t: price and change it to t: savings
0 Likes