Creating Custom Add to Cart Links
A lot of times when building a site or theme with Easy Digital Downloads, you will want to create custom purchase/add-to-cart buttons that allow your users to purchase a digital product. Sometimes the button options that come with EDD are quite suited to your application. Luckily, there is a very simple way to turn any hyperlink into a “purchase button”.
Let’s say that you have a hyperlink displayed on your product details that says “Purchase This”, and you have styled it exactly as you want. The only thing you have left is to turn the link into one that automatically adds the current item to the shopping cart. It’s very simple and the basic format looks like this:
would be replaced with the actual ID number of your download.
If, when clicked, you want the link to automatically take the user to the checkout page, do this:
“http://yoururl.com/checkout” would be replaced with the full URL to your checkout page.
If you are displaying the link on the single page for the “download” post type, then you can do this (it will automatically append the ID):
Sending Customers Straight to PayPal
If you’d like your customers to be sent straight to PayPal, instead of to the checkout page, use a URL like this: