Selling software downloads

Selling file downloads with CartThrob is straightfoward.

  1. Create an entry in your product channel that stores one or more fields containing a file path (file, a text field, etc)

  2. Add the item like normal to your cart:

    {exp:cartthrob:add_to_cart_form entry_id="{entry_id}" return=""}
        <input type="submit" value="Add to Cart" />
    {/exp:cartthrob:add_to_cart_form} 
  3. When the order is complete, all you need to know to download the file is the entry id of the product, and the short_name of the download field in the channel entry and CartThrob will figure out the file path. Use this information with the get_download_link tag or the download_file_form. Either method obfuscates/encrypts information relating to the file. Both methods can access files stored above the root of the website, and can handle file sizes over 1gb. download_file_form outputs a form, rather than a link and can't be shared. get_download_link outputs a link which can be copied and shared. Depending on parameters, it may lock the link to a specific member or group.

    {exp:cartthrob:get_download_link entry_id="{entry_id}" field="product_download_url"}