All posts
8 min read

What does "comparison of Integer with String failed" mean in Shopify?

It means an {% if %} tag in your theme compared a number with a piece of text using >, <, >= or <=, and Liquid refuses to say which is bigger. The usual culprit is a threshold the merchant typed into a text setting, such as a free shipping amount or a low stock count, compared against cart.total_price or an inventory number, which Shopify prints as Liquid error (sections/cart-bar line 6): comparison of Integer with String failed.

The fix is to turn the text into a number before the if: {% assign limit = section.settings.threshold | plus: 0 %}, then compare against limit. Below is what Shopify printed for 44 comparisons we ran on a development store on 27 October 2026, including 5 that give the wrong answer with no error at all.

Where does the error come from in my theme?

Read the text in brackets: it names the file and the line, without the .liquid ending, so sections/cart-bar line 6 is line 6 of sections/cart-bar.liquid. In Online Store, Themes, the three dots, Edit code, open that file and look at the if on that line. It will match one of these:

What the line comparesWhich side is textFix
cart.total_price > section.settings.free_shippingThe threshold, because it is a text settingAssign it with | plus: 0 first, or make the setting a number or range
variant.inventory_quantity < section.settings.low_stockThe low stock count, saved as textSame: | plus: 0 in an assign
product.price > '1000'The quoted number. Quotes make it textRemove the quotes: product.price > 1000
A value from the money filter, such as price | moneyThe formatted price, $10.00, is textCompare product.price (a number in cents) and format it only for display
'now' | date: '%Y' compared with 2025The year. Every date result is textAdd | plus: 0 after the date filter in the assign
product.title.size > '5'The quoted '5'Remove the quotes

If you only use the theme editor and do not edit code, there is no setting that makes this go away. Either ask the theme developer for a fix, or clear the setting that feeds the comparison. In our test that only helped for a number setting, not a text one (see below).

What did Shopify print when we tested it?

We pushed a test theme to a Shopify development store with Shopify CLI 3.93.1 on 27 October 2026, rendered its homepage, read the HTML, and deleted the theme afterwards. The cart was empty, so cart.total_price was 0; the first product cost $10.00, so product.price was 1000. Some of the 44 cases:

The comparisonWhat Shopify rendered
5 > '3'Liquid error (sections/probe line 4): comparison of Integer with String failed
'5' > 3comparison of String with 3 failed
5 < '10'comparison of Integer with String failed
cart.total_price > section.settings.free_text, a text setting holding 5000comparison of Integer with String failed
The same against a text setting left emptycomparison of Integer with String failed
The same against a number setting holding 5000No error: false
The same against a number setting left emptyNo error: false
The text setting assigned with | plus: 0 firstNo error: correct answer
The text setting assigned with | times: 1 firstNo error: correct answer
variant.inventory_quantity < section.settings.low_text, text 5comparison of Integer with String failed
The same against a range setting of 5No error: correct answer
product.price > '1000'comparison of Integer with String failed
price | money ($10.00) > 10comparison of String with 10 failed
The year from 'now' | date: '%Y' (2026) > 2025comparison of String with 2025 failed
'5.5' > 5comparison of String with 5 failed
A missing variable, missing global setting or missing metafield, either sideNo error: false
product.compare_at_price > product.price with no compare at priceNo error: false
10 | divided_by: 0 and 10 | modulo: 0Liquid error (sections/probe line 17): divided by 0

Two things stand out. First, the empty setting rows split by type: an empty number setting compares quietly as false, but an empty text setting still errored, so clearing a text box does not make the message go away. Second, a value Shopify does not have at all (a missing variable, metafield or compare at price) never errors in a comparison. That is why sale badge code such as compare_at_price > price is safe on products with no sale price.

Why does it sometimes say "comparison of String with 3 failed"?

Because the wording depends on which side is the text. When the number is on the left, as in 5 > '3', Shopify names both types: comparison of Integer with String failed. When the text is on the left, as in '5' > 3, it names the type of the left side and then the actual number on the right: comparison of String with 3 failed. So comparison of String with 0 failed, with 2025 failed and with 10 failed are all the same fault, and the number in the message is the value your code compared against, which helps you find the line.

How do I fix it in the theme code?

Convert the text to a number in an assign, then compare the result. This is the pattern that gave the correct answer in our test:

{%- assign limit = section.settings.free_shipping | plus: 0 -%}
{%- if cart.total_price >= limit -%}
  You get free shipping.
{%- endif -%}

Do not try to put the filter inside the if. Liquid does not allow filters in conditions, and Shopify refused the file on upload with Liquid syntax error (line 1): Expected end_of_string but found pipe in "'10' | plus: 0 > 9". Because the template that used that section then pointed at a file that did not exist, it was refused too, with Section type 'filtercond' does not refer to an existing section file. If that second message is the one you are looking at, why a Shopify theme ZIP will not upload explains the chain.

How plus: 0 treats odd input, from the same test:

  • '49.99' | plus: 0 gave 49.99, so decimals survive.
  • '12abc' | plus: 0 gave 12 and 'abc' | plus: 1 gave 1: text that is not a number becomes 0 or its leading digits, with no error.
  • '' | plus: 0 gave 0, so an empty text setting becomes 0. If 0 would switch your feature on, check the setting with != blank before comparing.

The cleaner fix, if you can change the schema, is to make the setting a number or range, which Shopify stores as a number. Changing a setting's type on a theme that is already in use can leave old saved values behind, so try it on a duplicate of the theme first. Whichever you pick, remember that Shopify prices are in cents: our product.price > 10.00 test said yes for a product that costs exactly $10.00, because it compared 1000 with 10.

Which comparisons give the wrong answer with no error?

These are worse than the error, because nothing on the page tells you. All five rendered silently in our test:

CodeResultWhy
'10' > '9'falseTwo pieces of text compare letter by letter, and "1" comes before "9"
5 == '5'falseA number never equals text, even with the same digits
{% case '5' %}{% when 5 %}no matchSame rule as ==
'1,2,3' | split: ',' contains 1false (contains '1' is true)split always returns text items
product.price > 10.00 on a $10.00 producttruePrices are in cents, so it compared 1000 with 10

The same plus: 0 fix applies to the first four: convert the text, then compare numbers.

Does the error break the rest of the page?

No, only that one if. In our test the rest of the section and the rest of the page rendered normally. But inside the block the error replaces every branch: {% if 5 > 'a' %}A{% elsif true %}B{% else %}C{% endif %} printed the error and neither B nor C, and unless behaved the same way. With and, one bad comparison errors the whole condition. With or, it depends on the order: true or 5 > '3' printed the true branch with no error, while 5 > '3' or true errored. Customers see the message as plain text in the page, the same as a Liquid error from an empty image.

Why didn't theme check catch it?

Because it only reads the code; it does not know what types the values will have when the page renders. We ran shopify theme check on the same test theme, including literal mistakes like 5 > '3', and it reported 2 warnings, both about an unknown variable name, and nothing about any comparison. The upload accepted the file too. The only place this error shows is the rendered page, so open every page type that uses a threshold after you change one, ideally with an empty cart and with items in it.

Where these results come from

Every rendered value and error above comes from one test theme with 44 comparison and math cases on its homepage, plus one upload case, pushed to a Shopify development store as an unpublished theme on 27 October 2026 with Shopify CLI 3.93.1 and deleted afterwards. The store had 13 products; the first cost $10.00, had no compare at price and 0 in stock, and the cart was empty. For other Liquid messages printed on the storefront, see what "invalid url input" means; for errors when a theme is pushed or uploaded, see what "default can't be blank" means; and for reading block settings in a loop, see how to loop through blocks in a Shopify section.

Frequently asked questions

What does "comparison of Integer with String failed" mean in Shopify?

An if tag compared a number with text using >, <, >= or <=. Liquid cannot order the two, so Shopify prints the error, with the file and line, where that if block should be. The usual cause is a threshold saved in a text setting compared with a price, cart total or stock count.

How do I fix comparison of Integer with String failed?

Convert the text to a number in an assign before the if: {% assign limit = section.settings.threshold | plus: 0 %}, then compare against limit. In our 27 October 2026 test that gave the correct answer with no error. Removing quotes around a typed number, such as '1000', fixes the literal case.

Can I use a filter inside an if tag in Shopify?

No. Shopify refused a section containing {% if '10' | plus: 0 > 9 %} on upload with "Liquid syntax error: Expected end_of_string but found pipe". Do the filter in an assign on the line before, then compare the assigned variable.

What does "comparison of String with 0 failed" mean?

The same fault with the text on the left side. Shopify names the left side's type and then the actual number on the right, so "comparison of String with 0 failed" means some text was compared with 0. Common sources are a money formatted price, a year from the date filter, or a text setting.

Will clearing the setting stop the error?

Only for a number setting. In our test an empty number setting compared as false with no error, but an empty text setting still printed comparison of Integer with String failed. For a text setting the code has to convert the value with plus: 0.

Why does '10' > '9' return false in Liquid?

Two pieces of text are compared letter by letter, and "1" sorts before "9". There is no error, just the wrong answer. Convert both with plus: 0 in an assign first. The same applies to 5 == '5', which is false, and to items from split, which are always text.

Does shopify theme check catch comparison errors?

No. In our test theme check reported nothing about comparisons such as 5 > '3', and the upload accepted the file. The error only appears when the page renders, so check the pages that use a threshold after changing it.

What does "Liquid error: divided by 0" mean?

A divided_by or modulo filter was given 0, often from an empty number setting or a count that came out at zero. Both printed "divided by 0" in our test. Check the divisor with an if before dividing.

Generate a theme that looks like your brand

A complete Shopify 2.0 theme with conversion features built in, ready in minutes. No credit card required.

Generate my theme free

No Shopify store yet? Start one here, then bring the theme. Themr may earn a commission if you start a paid plan; it does not change what you pay.