Skip to main content
Easy Digital Downloads Documentation
Documentation, Reference Materials, and Tutorials for Easy Digital Downloads

Purchase link shortcode

The [purchase_link] shortcode is used to display a purchase button for any download anywhere on your site. The button/link that is outputted will add the specified digital product to the shopping cart.

A default [purchase_link] is available for every Download in the Download’s settings, under Purchase Shortcode. You can copy/paste this link as is or update it with the optional parameters below.

The shortcode accepts a few optional parameters:

  • id – the ID number of the download for the button
  • sku – the assigned SKU value for the download (if enabled)
  • price – whether to show the product price or not. 1 to show it, 0 to hide it.
  • text – the text displayed on the button
  • style – the style of the purchase link, either “button” or “text”
  • color– the color of the button (when using the “button” style”:
    • gray
    • blue
    • green
    • dark gray
    • yellow
  • class – one or more custom CSS classes you want to be applied to the button
  • price_id – the variable price ID to create a purchase button for
  • direct – If set to “true”, it will use “Buy Now” mode, which bypasses the cart/checkout screen altogether. If set to “false”, it will add the product to the cart.

Example:

[purchase_link id="94" text="Add to Cart" style="button"]

A purchase button for a specific price option:

[purchase_link id="94" text="Add to Cart" style="button" price_id="2"]

Direct Purchase Example:

[purchase_link id="94" text="Buy Now" style="button" direct="true"]