3

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?)

3

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

  • Thanks a lot man! – sitian Gu Jul 19 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.