- Deprecated function
logBusinessEvent
atsrc/Core/Framework/Log/LoggingService.php
. - Deprecated
src/Core/Framework/Log/LogAwareBusinessEventInterface.php
useLogAware
instead.
We removed \Shopware\Core\Framework\Adapter\Twig\EntityTemplateLoader::clearInternalCache()
, use reset()
instead.
Bootstrap v5 introduces breaking changes in HTML, (S)CSS and JavaScript. Below you can find a migration overview of the effected areas in the Shopware platform. Please consider that we cannot provide code migration examples for every possible scenario of a UI-Framework like Bootstrap. You can find a full migration guide on the official Bootstrap website: Migrating to v5
The Update to Bootstrap v5 often contains the renaming of attributes and classes. Those need to be replaced. However, all Twig blocks remain untouched so all template extensions will take effect.
- Replace
data-toggle
withdata-bs-toggle
- Replace
data-dismiss
withdata-bs-dismiss
- Replace
data-target
withdata-bs-target
- Replace
data-offset
withdata-bs-offset
- Replace
custom-select
withform-select
- Replace
custom-file
withform-file
- Replace
custom-range
withform-range
- Replace
no-gutters
withg-0
- Replace
custom-control custom-checkbox
withform-check
- Replace
custom-control custom-switch
withform-check form-switch
- Replace
custom-control custom-radio
withform-check
- Replace
custom-control-input
withform-check-input
- Replace
custom-control-label
withform-check-label
- Replace
form-row
withrow g-2
- Replace
modal-close
withbtn-close
- Replace
sr-only
withvisually-hidden
- Replace
badge-*
withbg-*
- Replace
badge-pill
withrounded-pill
- Replace
close
withbtn-close
- Replace
left-*
andright-*
withstart-*
andend-*
- Replace
float-left
andfloat-right
withfloat-start
andfloat-end
. - Replace
border-left
andborder-right
withborder-start
andborder-end
. - Replace
rounded-left
androunded-right
withrounded-start
androunded-end
. - Replace
ml-*
andmr-*
withms-*
andme-*
. - Replace
pl-*
andpr-*
withps-*
andpe-*
. - Replace
text-left
andtext-right
withtext-start
andtext-end
.
<a href="#" class="btn btn-block">Default button</a>
<div class="d-grid">
<a href="#" class="btn">Default button</a>
</div>
<div class="input-group">
<input type="text" class="form-control">
<div class="input-group-append">
<button type="submit" class="btn">Submit</button>
</div>
</div>
<div class="input-group">
<input type="text" class="form-control">
<button type="submit" class="btn">Submit</button>
</div>
Please consider that the classes documented in "HTML/Twig" must also be replaced inside SCSS.
- Replace all mixin usages of
media-breakpoint-down()
with the current breakpoint, instead of the next breakpoint:- Replace
media-breakpoint-down(xs)
withmedia-breakpoint-down(sm)
- Replace
media-breakpoint-down(sm)
withmedia-breakpoint-down(md)
- Replace
media-breakpoint-down(md)
withmedia-breakpoint-down(lg)
- Replace
media-breakpoint-down(lg)
withmedia-breakpoint-down(xl)
- Replace
media-breakpoint-down(xl)
withmedia-breakpoint-down(xxl)
- Replace
- Replace
$custom-select-*
variable with$form-select-*
With the update to Bootstrap v5, the jQuery dependency will be removed from the shopware platform. We strongly recommend migrating jQuery implementations to Vanilla JavaScript.
// Previously Bootstrap plugins were initialized on jQuery elements
const collapse = DomAccess.querySelector('.collapse');
$(collapse).collapse('toggle');
// With Bootstrap v5 the Collapse plugin is instantiated and takes a native HTML element as a parameter
const collapse = DomAccess.querySelector('.collapse');
new bootstrap.Collapse(collapse, {
toggle: true,
});
// Previously Bootstrap events were subscribed using the jQuery `on()` method
const collapse = DomAccess.querySelector('.collapse');
$(collapse).on('show.bs.collapse', this._myMethod.bind(this));
$(collapse).on('hide.bs.collapse', this._myMethod.bind(this));
// With Bootstrap v5 a native event listener is being used
const collapse = DomAccess.querySelector('.collapse');
collapse.addEventListener('show.bs.collapse', this._myMethod.bind(this));
collapse.addEventListener('hide.bs.collapse', this._myMethod.bind(this));
In case you still need jQuery, you can add it to your own app or theme. This is the recommended method for all apps/themes which do not have control over the Shopware environment in which they are running in.
- Extend the file
platform/src/Storefront/Resources/views/storefront/layout/meta.html.twig
. - Use the block
layout_head_javascript_jquery
to add a<script>
tag containing jQuery. Only use this block to add jQuery. - This block is not deprecated and can be used in the long term beyond the next major version of shopware.
- Do not use the
{{ parent() }}
call. This prevents multiple usages of jQuery. Even if multiple other plugins/apps use this method, the jQuery script will only be added once. - Please use jQuery version
3.5.1
(slim minified) to avoid compatibility issues between different plugins/apps. - If you don't want to use a CDN for jQuery, download jQuery from the official website (jQuery Core 3.5.1 - slim minified) and add it to
MyExtension/src/Resources/app/storefront/src/assets/jquery-3.5.1.slim.min.js
- After executing
bin/console asset:install
, you can reference the file using theassset()
function. See also: https://developer.shopware.com/docs/guides/plugins/plugins/storefront/add-custom-assets
{% sw_extends '@Storefront/storefront/layout/meta.html.twig' %}
{% block layout_head_javascript_jquery %}
<script src="{{ asset('bundles/myextension/assets/jquery-3.5.1.slim.min.js', 'asset') }}"></script>
{% endblock %}
Attention: If you need to test jQuery prior to the next major version, you must use the block base_script_jquery
inside platform/src/Storefront/Resources/views/storefront/base.html.twig
, instead.
The block base_script_jquery
will be moved to layout/meta.html.twig
with the next major version. However, the purpose of the block remains the same:
{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_script_jquery %}
<script src="{{ asset('bundles/myextension/assets/jquery-3.5.1.slim.min.js', 'asset') }}"></script>
{% endblock %}
- The function
translatedTypes
insrc/app/component/rule/sw-condition-type-select/index.js
is removed. UsetranslatedLabel
property of conditions.
## Introduced in 6.4.8.0
The whole namespace `Shopware\Core\Framework\Changelog` was marked `@internal` and is no longer part of the BC-Promise. Please move to a different changelog generator vendor.