1. Description

Accessory Lock prevents customers from purchasing accessory products without having the required main product in their cart. Validation is fully server-side and cannot be bypassed via JavaScript or browser manipulation.

What the plugin does

Some products only make sense when the matching main product is also purchased — for example, a camera strap without a camera, or a charging cable without the compatible device. The plugin lets you configure these dependencies directly in the Shopware Admin and automatically enforces them at checkout.

Key features:

  • Cart validation: Accessories cannot be ordered without a matching main product in the cart. The error message names the missing product by name.

  • Admin UI: Every product detail page gets a dedicated "Accessory Lock" tab where you can assign and review dependencies.

  • Storefront hints: Customers are guided on accessory product pages by a "Buy Together" widget. Main product pages automatically display a compatible accessories section.

  • Variant inheritance: Configure the lock once on the parent product — all variants inherit the setting automatically.

  • n:n relationships: An accessory can accept multiple main products (any one of them in the cart is sufficient).

Storefront views

"Compatible accessories" section on the main product page

On a main product's detail page, a section with all compatible accessories is automatically displayed below the product description. Customers can add both products to the cart together with a single click.

Compatible accessories section on the main product page

"Buy Together" widget on the accessory product page

On an accessory product's detail page, a widget replaces the standard purchase area. It lists all compatible main products as selectable options. Once a main product is already in the cart, the widget switches to an adapted view — showing the in-cart product as such and revealing the standard buy button.

Buy Together widget on the accessory product page

Technical details

  • Compatible with Shopware ~6.6.0

  • Requires PHP 8.2+

  • No external services or API connections required

  • Server-side validation via CartValidatorInterface

  • Variant inheritance via Shopware's native DAL inheritance mechanism

Last updated