Best Answer Marcus Gesing , 23 December 2021 - 18:36
I would recommend doing this in a plugin and using widgets. Similar to what the Google Analytics plugin does. The plugin is quite simple. It checks the route data of the request to determine the checkout completed page and then loads the last order for the current customer. For the product detail page, you should be able to get the product ID from the route data as well, see the "productId" parameter.