Skip to content

Downloadable Products #2228

Answered by srindom
feelfetch asked this question in Q&A
Sep 16, 2022 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Where would you want to store the downloadable file?

I could see a few options for how this could work with what we have currently and then how it could be done in the future.

For the current setup you could do this:

  • In your Medusa project/plugin, create a custom entity src/models/downloadable-asset
    • Model will have id, variant_id, file_url (maybe also title, etc, etc)
  • Create a custom Service that handles the business logic - it will have:
    • create - takes variant and file_url, ensures uniqueness on variant id etc.
    • update - can be used to change the file_url
    • delete - use to an asset from a product
    • listForOrder - checks what downloadable assets are available for an order by going through…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@feelfetch
Comment options

@slavanga
Comment options

Comment options

You must be logged in to vote
1 reply
@slavanga
Comment options

Answer selected by srindom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants