Centurion Replace

by nlangerdevcenturion

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<body>
  <div id="checkout-review-table-wrapper">
    <p>
      Discount Code (NathanTest9856)
    </p>
  </div>
<span class="price">
  <p>
     £15.00
 </p>
</span>
</body>

JavaScript

console.log("Discount Code Script Loaded");
$(function(){
    if($('#checkout-review-table-wrapper p').text().replace(/\W/g, '')=="NathanTest9856"){
        console.log("Found code");
        $('span.price p').html("&pound;0.00");
        console.log("Shipping Total Corrected");
    } else{
        console.log("Coupon Code Not Found")
    }    
    console.log("Discount Code Script Completed");
});
console.log($('#checkout-review-table-wrapper p').text().replace(/\W/g, ''));