3

Suppose the number of products on a site, for example, more than 2 virtual products can be downloaded, and the buyer can download the file (same product) after purchasing each product. Now, I want to place a product for download, so that when I click on the download button of the purchased product, the desired file will be generated and downloaded according to the following description.

Let me explain with a simple example:

  1. One of the site's products is purchased by the buyer, and then the buyer goes to his own panel (EDD or Woocommerce) to download the purchased product and clicks on the button to download the purchased product. (There is no ready or pre-made file available for download and it must be made with the description below each product file)
  2. After clicking on the download button of the product purchased by the buyer, I want a PHP condition to check what is the ID and name of this product (which product is this purchased product) and then execute the PHP command related to this purchased product. (For example, product number 1 should execute PHP command number 1 and product number 63 should execute PHP command number 63)

For example, PHP commands are like this:

If (buyer_product_buyed = product_1) then run PHP Block Code 1
otherwise
If (buyer_product_buyed = product_2) then run PHP Block Code 2
otherwise
...
If (buyer_product_buyed = product_999) then run PHP Block Code 999

And the buyer's email should be put into a variable and a text file like the following values with the product name and ID and the buyer's email should be generated and this file should be downloaded:

Hello dear, $email
your product id is: $id_product and product name is: $product_name and purchased in $date and $time
thank you

Some notes:

  • No product is pre-made for download and all product files are generated and downloaded when clicking on the download button of each purchased product.
  • Each product executes its own PHP command.
  • The file generated in the above method must be downloaded for the buyer as a purchased product file.

I tried to explain very briefly and simply, if you need to explain more, please tell me in the comments.

Salvadora
  • 197
  • 7

0 Answers0