Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the Cart Insights will load the cart.json endpoint on every pageview. This means that an additional JSON request is sent for every pageload, which might slow down the experience on slower connections, and might slow down the server in high traffic scenarios.
Shopware by default already loads the 'Cart info widget' on every pageview. This widget also has the cart info available. By loading the Cart Insights inside this widget, it will push the correct state (cart insights & identification) to DotDigital, without the need of seperatly loading the cart.json endpoint.
It is possible that, due to custom theme changes, this might not work for some customer. For this I have added a configuration option so the user is able to choose between the two methods. The Cart Info-way will be better for performance, but the cart.json will work stabile on every system, even when the theme is overwriting the widget completely.