Easy digital downloads (EDD) has a few shortcodes, that you can use, to display the purchase buttons or prices for whichever product you want on whichever page you want. Let’s look at these shortcodes and how to use them.

Purchase link shortcode

Shortcode: [purchase_link] – EDD documentation for purchase_link shortcode.

EDD has a shortcode to display the purchase link/button of any product (or even product variations/variable pricing product), called purchase_link.

As you can see on the EDD documentation page, this shortcode has a few paremeters, but let’s look at the important ones:

  • id – the ID number of the download/product for the button
  • price – whether to show the product price or not. 1 to show it, 0 to hide it.
  • text – the text displayed on the button
  • class – one or more custom CSS classes you want applied to the button
  • price_id – the variable price ID to create a purchase button for
  • direct – whether the purchase button should send the customer straight to the FastSpring checkout or to the EDD checkout page.

Note: If you are setting the class parameter, then you should always use the edd-submit class as well. For example, if you want to add these classes to the purchase button: btn btn-primary, your class parameter for the purchase link shortcode should look like this: [purchase_link id="99" class="edd-submit btn btn-primary"]

How to get the download/product ID?

Edit the download/product you want to create a shortcode for. Once you are on the edit screen you can look at the URL, which should look something like this .../post.php?post=114&action=edit. The number 114 is the ID of the download/product you are editing. Or by looking in the Download Settings meta box on the side:

EDD purchase link shortcode ID
EDD purchase link shortcode ID

Examples

Normal download/product with ID=114, with “Add to Cart” text, with price showing in the button and we want the purchase button to add the product to EDD cart and on the second click we want to be taken to the EDD checkout page:

[purchase_link id="114" text="Add to Cart"]

Normal download/product with ID=114, with “Buy Now” text, without a price showing in the button and we want the purchase button to take us straight to FastSpring checkout:

[purchase_link id="114" text="Buy Now" price=0 direct="true"]

Variable download/product with ID=214, with “Add to Cart” text, with all prices to choose from (radio buttons) and we want the purchase button to add the product (price variation) to EDD cart and on the second click we want to be taken to the EDD checkout page:

[purchase_link id="214" text="Add to Cart"]

Variable download/product with ID=214, with “Buy Now” text, with all prices to choose from (radio buttons) and we want the purchase button to take us straight to FastSpring checkout:

[purchase_link id="214" text="Buy Now" direct="true"]

Variable download/product with ID=214, with price ID=2 , with “Buy Now” text and we want the purchase button to take us straight to FastSpring checkout:

[purchase_link id="214" price_id="2" text="Buy Now" direct="true"]

As you can see, this shortcode is very versatile. Choose the attributes you need and create your own shortcode.

Price shortcode

Shortcode: [edd_price] – EDD documentation for edd_price shortcode.

If you want to display an accurate price (FastSpring adds taxes to the price if applicable and converts to the client local currency) for your users, then you can do so with edd_price shortcode.

This shortcode only has two parameters:

  • id – the ID number of the download/product you wish to display the price for
  • price_id – the variable price ID to show the price for

Examples

Normal download/product with ID=114:

[edd_price id="114"]

Variable download/product with ID=214 and price ID=2:

[edd_price id="114" price_id="2"]