Storefront event webhooks in Shopware 6 app development

397 Views Asked by At

I developing an app and basicly if an user loaded a product in the storefront it should send a request to my server. So i thought thats possible with webhooks. But unfortunately there is no webhook for this case.

The closest thing i could find is the product.written webhook but that seems useless for my case.
Anyone has an idea how i could realize my request?

I use Shopware 6.4.11.1 as development enviroment.

1

There are 1 best solutions below

0
On

Although I have not found any appropriate webhook in the webhook events reference, this may be doable in a slightly different way, without using the Shopware App Webhook mechanic.

In the Shopware documentation there are shown ways to add Storefront scripts to an app. There is even an example for product-page-loaded. You would be able to execute some of your own code in there, but honestly I have not tried to ping external servers like this and I can't tell you that this will surely work.

You could also potentially add some custom JS code that pings your server with the appropriate info.

Unfortunately I don't think you can compel Shopware to send a request from its backend on a ProductPageLoadedEvent