Magento 2 not showing text swatches values

Magento 2 not showing text swatches values

September 12, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 2 not showing text swatches values

Magento 2: Resolving Text Swatch Display Issues

If you’re encountering problems with text swatches not displaying correctly after upgrading to Magento 2.3.1, you’re not alone. This issue is often caused by a misconfiguration in the theme or module settings. Let me walk you through how to troubleshoot and resolve this problem.

Understanding the Issue

In your local development environment, you’ve noticed that while text swatches are being sent correctly (as evident from the hover values), they appear as “null” on the front end. This suggests a rendering issue with JavaScript or a configuration inconsistency between old and new versions.

Step-by-Step Resolution Process

1. Check Theme Configuration

First, ensure your theme is properly configured for the new version of Magento. You may need to adjust your layout XML files to accommodate changes in the swatch module.

<referenceBlock name="catalog.product.list.toolbar">
    <block class="Magento\Swatches\Block\Product\ListItem\Renderer" as="swatch_renderer"/>
</referenceBlock>

Ensure this block is present and correctly referenced in your catalog_product_list.xml file within your theme directory.

2. Verify Swatch Attributes

Next, double-check that the attributes configured for text swatches are still valid after the upgrade. Navigate to Stores > Attributes > Product from your Magento admin panel.

Ensure:

  • The attribute is set as “Yes” for ‘Use in Product Listing’.
  • The input type matches ‘Text’.

3. Inspect JavaScript Files

Since there are no errors in the console log, let’s investigate the script files directly responsible for rendering swatches.

Open the requirejs-config.js file located at app/design/frontend/{your_vendor}/{your_theme}/Magento_Swatches and ensure it still references the required modules:

var config = {
    map: {
        '*': {
            'jquery/ui': 'jquery/jquery-ui-modules'
        }
    },
    shim: {
        'jquery/ui': {
            deps: ['jquery']
        }
    }
};

If this file is missing or incorrectly configured, it can prevent the swatch script from loading properly.

4. Recompile and Clear Cache

After making any necessary adjustments to your theme files or attribute settings, don’t forget to recombine JavaScript files and clear cache:

  • From Magento admin: Stores > Configuration > Advanced > Developer > Frontend
  • Enable ‘JavaScript settings’
  • Set ‘Merge JavaScript Files’ and ‘Minify JavaScript Files’ to ‘Yes’

Then, flush the cache using the “flush magento cache” command in your terminal.

Troubleshooting Tips

If you’re still encountering issues, consider:

  • Reviewing the official Magento 2.3 release notes for any relevant updates that might affect swatch rendering.
  • Comparing your theme configuration with a fresh Magento installation to identify any customizations causing conflicts.

Remember, always take a backup before performing any major changes to your production environment.

Conclusion

Resolving text swatch display issues in Magento 2.3.1 often involves a combination of verifying theme settings, checking attribute configurations, and ensuring the correct JavaScript files are loaded. By following this step-by-step guide and thoroughly inspecting your configuration, you should be able to restore proper text swatch functionality.

If you’re looking for more detailed guides on Magento development and optimization, I highly recommend exploring our dedicated resources at Laravel Company. We cover a wide range of topics to help you maximize your Magento experience.

Magento 2 Catalog Extensions Themes

Our network