Skip to content

Empty ‘showTooltips’ value causing console error and potentially breaking product quantity swatch

I need help with an issue I’ve been facing. The swatch to choose how many products to display on Magento 2 category pages is not functioning. It stays as the default, with no page load or changes after you choose a different option.

I have noticed there is a console error:

caught SyntaxError: Unexpected token ''', ..."Tooltip": ''
   "... is not valid JSON

And the corresponding JSON:

    {
    "[data-role=swatch-option-35413]": {
        "Magento_Swatches/js/swatch-renderer": {
            "selectorProduct": ".product-item-details",
            "onlySwatches": true,
            "enableControlLabel": false,
            "numberToShow": 16,
            "jsonConfig": {"attributes":{"139":{"id":"139","code":"designs","label":"Design","options":[{"id":"764","label":"Dancer","products":["12722"]},{"id":"759","label":"Indigo Girls","products":["35336"]}],"position":"0"}},"template":"R<%- data.price %>","currencyFormat":"R%s","optionPrices":{"35336":{"oldPrice":{"amount":769},"basePrice":{"amount":769},"finalPrice":{"amount":769},"tierPrices":[],"msrpPrice":{"amount":null}},"12722":{"oldPrice":{"amount":769},"basePrice":{"amount":769},"finalPrice":{"amount":769},"tierPrices":[],"msrpPrice":{"amount":null}}},"priceFormat":{"pattern":"R%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"oldPrice":{"amount":769},"basePrice":{"amount":769},"finalPrice":{"amount":769}},"productId":"35413","chooseText":"Choose an Option...","images":[],"index":{"35336":{"139":"759"},"12722":{"139":"764"}}},
            "jsonSwatchConfig": [],
            "mediaCallback": "httpsu003Au002Fu002Fwww.binuns.co.zau002Fswatchesu002Fajaxu002Fmediau002F",
            "jsonSwatchImageSizeConfig": {"swatchImage":{"width":30,"height":20},"swatchThumb":{"height":90,"width":110}},
            "showTooltip": ''
        }
    }
}

It has an issue with the empty showTooltip value in single quotes.

I am aware of the setting in catalog>catalog>Storefront>Show Swatch Tooltip.

However, changing this value from true to false or visa versa does not change the console error, nor does it allow the swatch to function again.

I have checked and the enabled theme does not extend the swatch-renderer.js file. So it seems to be a base magento issue.

The site is running Magento Open Source v2.3