I’m developing a custom members area in wich I need to show member’s past orders download link (for digital products). The problems are:
On “Orders” or “Products” CMS there is no download link to none of the products;
The function getOrder() doesn’t return any download link for the digital product, although the createOrder() function does mention:
If an item is digital - lineItems[i].itemType.preset: DIGITAL - then lineItems[i].digitalFile must be provided.
Which makes me believe that the download link to the digitalFile is correlated to the getOrder(), but I can’t figure out where to find it.
On the original members area, on “My orders” there is a list of historical orders with a download button, but the link expires in 30 days. On my custom members area I do not want the link to expire. Is that possible?
–
The main point is to find out how do Wix Stores understand that a file is attatched to a product since this information isn’t on any CMS and the documentation has not much about digital products. Where does the download link comes from when an user completes a purchase? How do I compare user’s orders to the products on my website to provide the downloadable link?
The actual flow is:
Retrieve member’s ID;
Search for member’s ID on "Orders"CMS and retrieve every order;
I haven’t tested this but you might try taking that wix:type:// prefixed url and passing it to downloadFiles - Velo API Reference - Wix.com to get back a download URL for the file.
As the reference states, the Orders collection can only be read with Admin permissions, so I don’t see how the user, when reaching the member’s area, could “access” this data (actually even I couldn’t access the data). Any ideas?
As I couldn’t read the Orders table as mentioned before, I couldn’t test it, but i believe that the mediaItem.src is the URL for one of the media available on the product page as the reference example show it on a Physical product. However, maybe the DIGITAL itemType does have a lineItems.digitalFile there, which is just unavailable on this example (and there is no example with an itemType : DIGITAL).
About the products, that’s what I meant, the product is available forever, but the link is not. So I need that every time an user tries to download his product a new link is generated.
This would be done by passing the suppressAuth: true option to your query. The function itself could be exposed to users with a Velo Web Method BUT you’ll want to make sure to not accidentally expose the wrong information to the wrong user.
This would be done by passing the suppressAuth: true option to your query.
Couldn’t make it work, @anthony . Even when running the query on backend I get no results; the suppressAuth: trueoption does work, but I could find no way to access the CMS. Have you ever tried it yourself? Would you be able to run it and send me a screenshot, if that’s not too big of a request? I really don’t see why it’s not working
Also, if you’ve got any news about the lineItems.digitalFile type, it would be wonderful to know.