🧠 Things I Wish I Knew Before Building My First Shopware Plugin

Building a custom plugin for Shopware 6 can feel exciting, especially if you come from a Symfony or PHP background. But once you dive in, the learning curve can be surprisingly steep. After developing several Shopware plugins, here are some things I really wish I had known earlier.


Table of Contents


Plugin or App? Know the Difference

Shopware offers two extension systems: plugins and apps. If you just need to display something, handle webhooks, or connect to an external API, apps are often simpler and update-safe. Plugins, on the other hand, offer deeper system-level integration. I jumped into plugins without realizing an app might've been enough.

Tip: Evaluate your needs carefully – plugins are powerful, but apps are easier to maintain and don't require direct code deployment on the shop server.


Embrace Dependency Injection Early

Shopware is built on Symfony, which means everything revolves around dependency injection. Your custom services, event subscribers, and classes won’t work unless properly defined in services.xml (or services.yaml, depending on setup).

Lesson: Don't assume your service is automatically injected. Use bin/console debug:container to see what's registered and where.


Read the Docs – Then Read the Core Code

The Shopware developer docs are helpful, but they don't cover everything. Some use cases (like customizing admin modules or extending checkout logic) may be outdated or missing. The best resource? The core source code and existing plugins.

Tip: Browse the Shopware GitHub repos and inspect how they build core features. Real examples are better than theory.


Cache: Your Best Friend and Worst Enemy

Made a change but nothing happens? Welcome to Shopware caching. You’ll often need to clear the cache using:

bin/console cache:clear

Also, remember to recompile the storefront or admin if working on those parts.

bin/console theme:compile
bin/console administration:build

Pro tip: Automate cache clearing in your local setup. It'll save your sanity.


Avoid Business Logic in Twig

It's tempting to put logic directly into your Twig templates, especially for quick fixes. But it's a trap. Shopware provides ViewSubscribers and Decorators for a reason.

Better approach: Keep templates clean. Move logic to PHP and inject variables into views.


Start Testing Early

When I built my first plugin, I skipped tests thinking it would be faster. Big mistake. Even a few unit or integration tests can save hours of debugging later on.

Suggestion: Add a basic PHPUnit setup. Even if it's just one or two tests at first, it pays off.


Reuse Existing Shopware Services

Need to upload files? Send emails? Generate thumbnails? Shopware probably already has a service for that. Don't reinvent the wheel.

Example: The media.service handles file uploads and is way more robust than anything I could’ve written on the fly.


Conclusion

Shopware plugin development is incredibly powerful but comes with complexity. Understanding the underlying Symfony architecture, leveraging existing services, and writing clean, maintainable code can make the difference between a headache and a success story.

If you're just starting out: stay curious, stay patient, and read the core.


💬 What about you?

What was your biggest "aha!" moment when working with Shopware (or Symfony)? Drop it in the comments – I'm always curious to hear other devs' lessons learned!


Need help with Shopware plugin development?

I offer freelance services for custom plugin development, troubleshooting, and consulting.

👉 https://stefanpilz.ltd/en/shopware-freelancer/shopware-plugin-development