In Drupal 8, I am needing to know how to assign/add an entity reference of an e-book to an multivalue entity reference field of the user when an order with the e-book is placed. This will allow the user to then access only the e-books attached to his user account.
What hook do I use? how do I know if there is a product in the order that have field_ebook=true? Then how do add it to the list of entity references?