Guest User

Untitled

a guest
Feb 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <script type="text/javascript">
  2. document.addEventListener('DOMContentLoaded', function () {
  3. var myCustomPriceActions = function() {
  4. var price = parseInt( document.querySelector("ul.order-details .order-details-total em[data-currency]").innerHTML.replace( "$", "" ) );
  5. var credit_card_element = document.querySelector("#form-order > .credit-cards" );
  6.  
  7. if( price === 0 ) {
  8. credit_card_element.style.display = "none";
  9. } else {
  10. credit_card_element.style.display = "block";
  11. }
  12. };
  13. /** Mutation Observers didn't seem to do the trick, we're cheating with timeouts **/
  14. myCustomPriceActions();
  15.  
  16. setTimeout( function() {
  17. myCustomPriceActions();
  18. }, 200 );
  19.  
  20. setTimeout( function() {
  21. myCustomPriceActions();
  22. }, 500 );
  23. });
  24. </script>
Add Comment
Please, Sign In to add comment