Template Tags: Downloads
CartThrob supports protected file downloads for both free and purchased files.
You can use CartThrob download tags to hide file locations, generate member/role-restricted download access, and deliver files through form-based or link-based flows.
Download Delivery Tags
Use these tags as the main download entry points.
Form-based download
This is generally the most restrictive pattern because no reusable direct link is exposed in the page source. The download is submitted through a protected form/action flow.
- download_file_form Generate a protected form submit that downloads a file through
download_file_action.
Link-based download
Use this when you need a shareable URL (email/invoice/account pages). Access can still be restricted by member/role parameters.
- get_download_link Generate an encrypted download URL for file delivery through
download_file_action.
Legacy direct-download helpers
- download_file Execute an immediate direct-download attempt from file/entry inputs (legacy helper).
- view_download_link Build a legacy encrypted download path by appending encrypted segments to a template path.
Supporting Purchase Context Tags
These tags are commonly used with download tags to render purchased items and attach download buttons/links to each item:
- order_items Iterate purchased line items and output item-specific download links/forms (also used on Cart page and Checkout page).
- member_downloads Output purchased-item channel entries for the current logged-in member.
Legacy/Code-Available Download Tags
These legacy download tags are code-supported and now documented:
These appear in legacy tutorial patterns (for example software-download examples). For new implementations, prefer download_file_form and get_download_link.
Notes and Constraints
- CartThrob download flows do not provide built-in IP tracking, time-expiry links, or download-count limits.
- If account credentials are shared, protected downloads may still be accessed by multiple users under that account.
- For high-control scenarios, add external safeguards (for example tighter account controls, role design, or additional download-governance tooling).