Skip to main content Skip to search Skip to main navigation
Diese Seite ist auch auf Deutsch verfügbar.
momocode

Accessory Lock — Require Main Product

Rating: no rating ( write a review )
Downloads: <10

Description

Highlights

  • Cart enforcement: accessories only purchasable with main product
  • Server-side validation – cannot be bypassed via JavaScript
  • Storefront Buy Together widget with one-click Add Together to cart
  • Admin assignment UI directly on the product – with reverse view
  • Variant inheritance: configure once, all variants protected

Features

  • Server-side cart validation via CartValidatorInterface
  • n:n relationships: one accessory can allow multiple main products
  • Error message names the missing main product (DE + EN)
  • Storefront: Buy Together widget on accessory product detail pages
  • Cart-aware layout: shows different view when main product is already in cart
  • Main product page: "Compatible accessories" section with product slider
  • Add Together button adds both main product and accessory in one action
  • Admin "Accessory Lock" tab on every product detail page
  • Reverse view: shows which accessories require this product as main product
  • Variant inheritance via native Shopware DAL inheritance mechanism
  • Per-variant override: break inheritance and assign different main products
  • Config toggle: accessories section can be disabled without affecting cart validation
  • All storefront texts are Shopware snippets — customisable via Settings → Snippets

About the Extension

Accessories Only Purchasable With Their Main Product

Do you sell products that only make sense alongside a specific main product — proprietary batteries, spare parts, extension modules, or bundled accessories? Accessory Lock closes this gap: customers can only purchase accessory products when the required main product is already in their cart.

Key Benefits

  • Cart protection without JavaScript dependency — Validation runs server-side and cannot be bypassed by disabling JavaScript.
  • Clear error messages — Customers see exactly which main product is missing, not a generic error.
  • Storefront guidance — A Buy Together widget on the accessory product page leads customers directly to the right combination.
  • Configure once with variant inheritance — Assign the lock to the parent product — all variants are protected automatically.

Features in Detail

Server-Side Cart Validation

Using Shopware's CartValidatorInterface, every cart update is checked to ensure all accessory products have a valid main product in the cart. If the main product is missing, the accessory is blocked and a multilingual error message is shown, naming both the accessory and the required main product(s).

The n:n relationship allows assigning multiple allowed main products to a single accessory — the cart is valid as long as any one of them is present.

Storefront: Buy Together Widget on Accessory Pages

On an accessory product's detail page, a widget automatically appears listing all compatible main products as selectable options. Customers choose which main product to buy together with the accessory — and add both to the cart in a single click.

If the main product is already in the cart, the widget shows an adapted layout indicating that the combination is complete, and the standard buy form for the accessory is shown.

Storefront: "Compatible Accessories" Section on Main Product Pages

On the main product's detail page, a product slider section automatically lists all compatible accessories. Each card includes an "Add Together to Cart" button that adds both the main product and the accessory simultaneously. The section can be disabled in the plugin settings without affecting cart validation.

Admin UI: Manage the Lock Directly on the Product

Every product detail page in the Shopware Admin gains a dedicated "Accessory Lock" tab. From there, you assign as many required main products as needed. A reverse view shows which other products require this product as their main product — giving you a complete picture of both sides of the relationship.

Variant Inheritance

The accessory lock is passed to product variants via Shopware's native DAL inheritance mechanism. Configure the lock once on the parent product — all variants are automatically protected. Individual variants can be overridden in the Admin tab if a specific variant requires a different main product than its sibling variants.

Technical Details

  • Shopware compatibility: ~6.6.0
  • PHP 8.2+
  • No external services or API calls required
  • Fully verified at PHPStan Level 8
  • Storefront and Administration fully bilingual (German + English)
  • All storefront texts (hints, buttons, error messages) use Shopware's native snippet system — customisable via Settings → Snippets, e.g. to replace the term "accessory" with your own terminology

Details

  • Available: English, German
  • Latest update: 17 March 2026
  • Publication date: 26 March 2026
  • Version: 1.0.0
  • Category: Conversion Optimization

Resources

Reviews (0)

Write a review

If you downloaded this extension you can write a review in the Shopware Account.

Write a review

About the Extension Partner

Partner Status

  • Shopware Extension Partner Shopware
    Extension Partner

Details

  • Ø-Rating: 5

    Average rating of 5 out of 5 stars

  • Partner since: 2019
  • Extensions: 6

Support

  • Based in: Germany
  • Speaks: German, English
  • Response time: Very quickly