Shopware 6.7.16: How to Correctly Configure JSON-LD Data Feature Flag

Navigating Shopware updates can sometimes present unexpected configuration challenges, especially when core functionalities are refined. A recent discussion in the Shopware forum highlighted a critical change affecting the JSON_LD_DATA feature flag in Shopware version 6.7.16.0. This feature, vital for SEO by providing structured data to search engines, saw a configuration overhaul that caught some users off guard.

The Challenge: JSON_LD_DATA Configuration Breakage in Shopware 6.7.16

A user, R4M, reported that their previously working configuration for enabling the JSON_LD_DATA feature flag in Shopware 6.7.15.x stopped functioning after upgrading to 6.7.16.x. The standard method they used involved defining the flag within their z-shopware.yaml file:

  feature:
    flags:
      - name: JSON_LD_DATA
        default: true
        major: false
        description: 'Storefront emits JSON-LD instead of Microdata'

Upon upgrading, this configuration began to cause an error, specifically a deprecation warning related to Symfony's XML configuration format:

User Deprecated: Since symfony/dependency-injection 7.4: 
XML configuration format is deprecated, use YAML or PHP instead;

While this message appeared when the feature flag was included, it was initially misleading, as other parts of the z-shopware.yaml seemed to work correctly.

The Expert Diagnosis: A Change in Feature Flag Semantics

Julian_Braeucker, an expert contributor, quickly clarified the situation. The Symfony deprecation warning was a red herring, unrelated to the actual problem with the feature flag. The core issue lay with the major: false setting in the custom feature flag definition. In Shopware 6.7.16, the configuration of feature flags underwent a significant change:

  • The major property is no longer a simple boolean (true/false).
  • Instead, major now expects a version string (e.g., v6.8.0.0) indicating the Shopware version in which the flag becomes standard.

Attempting to use major: false in 6.7.16 causes the configuration validation to fail, preventing the Shopware container from being built correctly. The actual critical error message would likely be found further down in the output, indicating a problem with the configuration structure.

The Solution: Enabling JSON_LD_DATA the New Way

Julian_Braeucker explained that the JSON_LD_DATA feature flag is now defined internally by Shopware itself, with a default major: v6.8.0.0 and toggleable: true. Therefore, users no longer need to define the flag manually in their YAML configuration. Instead, they simply need to enable the existing flag. Two primary methods are available:

1. Using an Environment Variable (Recommended for Clarity)

The most straightforward and environment-specific method is to set an environment variable in your .env.local file. This method takes precedence over other configurations:

JS>

2. Using the Console Command

Alternatively, you can enable the feature flag via the Shopware console. This method stores the setting directly in the database:

bin/console feature:enable JSON_LD_DATA

Post-Configuration Steps

After applying one of the above solutions, it's crucial to perform two additional steps:

  1. Remove the Custom Flag Block: Delete the old JSON_LD_DATA feature flag definition block from your z-shopware.yaml file.
  2. Clear the Cache: Always clear the Shopware cache to ensure the new configuration takes effect:
    bin/console cache:clear

The initial user, R4M, confirmed that this explanation was precisely what they needed, highlighting the importance of understanding these changes when migrating between Shopware versions. This insight is particularly valuable for anyone upgrading to or working with Shopware 6.7.16.0 and beyond, ensuring their structured data for SEO remains intact and correctly configured.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools