Answers.Body: <p>You would start out by listing the digital products in your templates. For example, if you had digital product type with the handle of <code>onlineCourses</code>, you would get the list of products like this:</p>
  
  <pre><code>{% set products = craft.digitalProducts.products({type: 'onlineCourses'}).order('price desc') %}
  </code></pre>
  
  <p>Looping through those is just like looping through variants (since digital products don't have variants) or entries. One thing to note, is that currently digital products do no have a <code>salePrice</code>, if you've been using that for Commerce products - just <code>price</code>.</p>
  
  <p>You would add digital products to the cart exactly like you would add a Commerce product and, as soon as an order is completed, any digital products that were in the order will have their licenses automatically generated.</p>
  
  <p>Please note, unlike Craft Commerce standard products where the purchasable is the products' variant, in the case of Digital Products, the purchasable is the product itself.</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;input type="hidden" name="purchasableId" value="{{ product.defaultVariant.purchasableId}}"/&gt;
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>&lt;input type="hidden" name="purchasableId" value="{{ digitalProduct.purchasableId}}"/&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-06T04:30:15.430Z
Answers.LastActivityDate: 2016-07-06T15:33:57.207Z
Answers.LastEditDate: 2016-07-06T15:33:57.207Z
Answers.UserDisplayName: Andris Sevcenko
Body: <p>I'm trying to use the fresh new <a href="https://github.com/pixelandtonic/DigitalProducts" rel="nofollow">Digital Products</a> plugin in my website.</p>
  
  <p>I managed to create some products and assigned licenses, I see some  licenses when I log in as an end user - but the last link is missing. </p>
  
  <p>What is the process of getting a specific product object in my "digital product detail page", adding it into the order along with other products, paying and getting the license auto generated?</p>
  
Tags: <plugin-craftcommerce><plugin-digitalproducts>
Title: How do I actually add a Digital Product to an order?
ThreadText: # How do I actually add a Digital Product to an order?
  
  (Asked by: username_0 on 2016-07-06)
  
  I'm trying to use the fresh new [Digital Products](https://github.com/pixelandtonic/DigitalProducts) plugin in my website.
  
  I managed to create some products and assigned licenses, I see some licenses when I log in as an end user - but the last link is missing.
  
  What is the process of getting a specific product object in my "digital product detail page", adding it into the order along with other products, paying and getting the license auto generated?
  
  **Tags:** plugin-craftcommerce, plugin-digitalproducts
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-07-06. Score: 2
  
  You would start out by listing the digital products in your templates. For example, if you had digital product type with the handle of `onlineCourses`, you would get the list of products like this:
  
  ```
  {% set products = craft.digitalProducts.products({type: 'onlineCourses'}).order('price desc') %}
  
  ```
  
  Looping through those is just like looping through variants (since digital products don't have variants) or entries. One thing to note, is that currently digital products do no have a `salePrice`, if you've been using that for Commerce products - just `price`.
  
  You would add digital products to the cart exactly like you would add a Commerce product and, as soon as an order is completed, any digital products that were in the order will have their licenses automatically generated.
  
  Please note, unlike Craft Commerce standard products where the purchasable is the products' variant, in the case of Digital Products, the purchasable is the product itself.
  
  For example:
  
  ```
  <input type="hidden" name="purchasableId" value="{{ product.defaultVariant.purchasableId}}"/>
  
  ```
  
  vs
  
  ```
  <input type="hidden" name="purchasableId" value="{{ digitalProduct.purchasableId}}"/>
  
  ```
  
  
  ---
  
  