Add Download Button For Virtual Products For Paying Customers

Author:

Date:

This code adds a download button linked to the virtual downloable product, if it exists, on the single product page. The code :

Checks if the customer is logged in, if not, the button will not display. Checks if the customer has bought the product and the order has completed, otherwise the button does no display. Checks the URL for the link to the download has been added as a download file to the single product otherwise, the button does not display. Works with Gutenberg block and non block classic editor themes. Doesn’t affect the default add to cart button unless

This is the first part of the article

Add Download Button For Virtual Products For Paying Customers

wpforms banner