Marketplace Redirect
External buy button instead of add-to-cart for Sylius 2 - Amazon (ASIN) and Shopware Store, switchable per channel, storefront and Shop API, Admin API for imports.
Marketplace Redirect
This documentation always describes the latest published version.
Overview
Marketplace Redirect replaces a product's "Add to cart" button with a button to an external marketplace. It is meant for products that cannot be bought in your shop, such as a book you sell on Amazon or a plugin you distribute through the Shopware Store. Two marketplaces are supported: Amazon (by ASIN or ISBN-10) and the Shopware Store (by product URL).
A product without a link is sold as usual. The Twig storefront and the Shop API show the same thing, and a channel that has not been switched on keeps the normal cart button everywhere.
Safe on failure: If the database table is missing or a stored reference is no longer valid, the product page shows the normal cart button and writes a warning to the log instead of failing with an error.
graph LR
A["Admin: link on the product"] --> C{"Channel switched on?"}
C -->|"No"| D["Normal cart button"]
C -->|"Yes"| E{"Product has a link?"}
E -->|"No"| D
E -->|"Yes"| F["Storefront: external buy button"]
E -->|"Yes"| G["Shop API: redirect endpoint"]
Documentation
| Page | Content |
|---|---|
| Installation | Composer, bundle, admin routes, setup command, update, uninstallation |
| Configuration | Switching on a channel, link on the product, validation rules, practical examples |
| Storefront | How the buttons look, Twig hooks and functions, Content Security Policy |
| Shop API | Endpoint for headless clients, response and error behaviour |
| Admin API | Create, change and delete links by import or automation |
| Extending | Adding another marketplace, replaceable services |
| Troubleshooting | Common problems, known limitations, FAQ |
| Technical | Flow, plugin structure, tables |
Features
| Feature | Description |
|---|---|
| Two marketplaces | Amazon (ASIN or ISBN-10, selectable Amazon domain) and Shopware Store (product URL) |
| Switchable per channel | The plugin is off in every channel until you switch it on there |
| Link on the product | An "External purchase" card in the admin product form, the reference is validated on save |
| Dual-mode | The Twig storefront and the Shop API show the same thing, a headless client receives the finished URL |
| Admin API | Create, read, change and delete links in full, for imports and automation |
| Marketplace look | Amazon button in Amazon yellow, Shopware Store button in white with Shopware blue and logo |
| Accessible | The link opens in a new tab (rel="noopener noreferrer nofollow") and tells screen readers it leaves the site |
| No theme override | The cart block is switched off by a decorated hook renderer, no core template is copied |
| Fails safe | A database error (such as a missing table) or a stored reference that is no longer valid leads to the normal cart button |
Requirements
| Requirement | Version | Notes |
|---|---|---|
| PHP | ^8.3 | |
| Sylius | ^2.2 | CI tests Sylius 2.2 and 2.3 |
| Symfony | ^7.4 | |
| API Platform | ^4.3 or ^5.0 | Packages api-platform/doctrine-orm, metadata, state, validator |
| Database | MySQL 8 | The migrations are MySQL-specific. Tested with MySQL 8.0 and 8.4 |
License
Commercial license: one license covers one Sylius installation (all channels plus its development and staging environments), no redistribution, updates for 12 months from purchase. The bundled cart icon (Tabler Icons) keeps its own MIT license.
Support
For questions about the license, technical questions or bugs, reach me at support@markus-michalski.net.