diff --git a/startbootstrap-agency-gh-pages/checkout.php b/startbootstrap-agency-gh-pages/checkout.php index fa7cda83cd8be65acbfea299385ae34eda55dab6..17f70f8e71c798d78a9482c04903c10be2fd7904 100644 --- a/startbootstrap-agency-gh-pages/checkout.php +++ b/startbootstrap-agency-gh-pages/checkout.php @@ -105,7 +105,7 @@ echo $text; <li class="list-group-item d-flex justify-content-between bg-light"> <div class="text-success"> <h6 class="my-0">Promo code</h6> - <small>EXAMPLECODE</small> + <small id = "idCodeshow"></small> </div> <span class="text-success"></span> </li> @@ -329,12 +329,19 @@ echo $text; console.log(response); totalPrice = totalPrice - (totalPrice * discount); // Appliquer la remise console.log(totalPrice); + var discountInfo = ""; + if (discount) { + discountInfo += "Promo Code Applied: " + promoCode; + discountInfo += " - Discount: " + (discount * 100) + "%"; + } // Update the displayed total price $("strong").text(totalPrice.toFixed(2) + " €"); + + // Update the discount information in the small tag + $("#idCodeshow").text(discountInfo); + + }, - error: function() { - // En cas d'erreur, ne rien faire ou afficher un message d'erreur - } }); } @@ -378,7 +385,7 @@ echo $text; data: data, success: function(response) { // Redirect to the thank you page upon successful response - // window.location.href = 'thank_you_page.php'; + window.location.href = 'thank_you_page.php'; }, error: function() { // Handle error if needed