I want to construct a countdown timer so the customer gets discount on price if he buys the product before countdown ends.
I’ve search internet and found a lot about countdown timer using Jquery, Javascript…
But how can i say in PHP that if the countdown is running then the product has 50% discount
Else if countdown ends(00:00:00) delete discount, return product’s price to normal.
The price is stored in the database.
No need for timer. Jut store discount date time in database with product.
and if purchase time is within that time apply 50% discount else no discount. You can do this by any means either apply if/ else condition using PHP or handle if/else and datetime comperisions in mysql query.