How do I actually add a Digital Product to an order?
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:

&lt;input type="hidden" name="purchasableId" value="{{ product.defaultVariant.purchasableId}}"/&gt;


vs

&lt;input type="hidden" name="purchasableId" value="{{ digitalProduct.purchasableId}}"/&gt;