my-cookie-permission
, as it's extending the default cookie-permission
plugin.<plugin root>/src/Resources/app/storefront/src/my-cookie-permission
directory and put an empty file my-cookie-permission.plugin.js
in there. The latter will be your main plugin class file.cookie-permission
plugin class, so you can extend from it.this.options.cookieName
is set in the CookieStorage
. The latter is just a neat helper from Shopware 6 itself to simplify dealing with cookies in JavaScript.init()
method and make sure this value is always set to an empty string, which will evaluate to false
.init()
method of the original plugin._hideCookieBar()
function to show the dialogue and only call the parent implementation if the user clicks "OK" in the confirm dialogue. So your whole plugin now looks like this:main.js
in the directory <plugin root>/src/Resources/app/storefront/src/
, which represents the automatically loaded entry point for javascript files in a plugin.PluginManager
from the global window object for this. But instead of using the register()
function to register a new plugin, you use the override()
function to indicate that you want to override an existing plugin.