Show purchase buttons in template files with edd_get_purchase_link()
You can manually display a purchase link for any product by using the
edd_get_purchase_link() function. This will output the purchase options for the specified product.
In its simplest form, the function can be used like this:
echo edd_get_purchase_link( array( 'download_id' => 37 ) );
If the specified product has
variable prices enabled, the price options will be displayed above the purchase button.
The function takes a number of possible arguments:
- download_id – The ID number of the product to show a purchase link for
- price – TRUE/FALSE whether or not to show the price on the button
- direct – TRUE/FALSE whether to create a “Buy Now” button or an “Add to Cart” button. Set to TRUE for a buy now behavior
- text – The text to show on the button
- style – button/plain the style of link to show
- color – The color of the button to show
- class – Custom class to add to the button wrapper element