Domanda

I want to fire an action when a user has downloaded a downloadable product (i.e. they have clicked the link for the download). I don't know what event I should be observing to do this. I tried to search through the list of Events here:

https://www.simicart.com/blog/magento-2-events-list

But none of them seem to correspond to the event I'm looking for. Any ideas on what event corresponds to this? Or another way of observing this action? (i.e. via plugin perhaps?)

È stato utile?

Soluzione

You can use controller_action_postdispatch_downloadable_download_link. Note that this can include invalid requests for download etc. Additional validation will be required based on your requirements. To get product downloaded load (by link_hash) \Magento\Downloadable\Model\Link\Purchased\Item received in id GET parameter. Note that I also answered your question on Reddit :D

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top