Edit Header button text/url (One Page)

Suppose you have a button with text: Contact Us on Header
You want to rename this to another text + another url on a specific page
You can use this code to Page Settings Advanced Code Injection

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("a.btn").html(function() { 
          return $(this).html().replace("Contact Us", "new text");  
    });
  $("a.btn").attr('href','https://google.com');
});
</script>

Replace Google with new url

In case you need to edit button on Cart Page, because Cart Page has no Code Injection option, so you can add this code to Website Tools (under Not Linked) > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("body#cart a.btn").html(function() { 
          return $(this).html().replace("Contact Us", "new text");  
    });
  $("body#cart a.btn").attr('href','https://google.com');
});
</script>

And if you want to apply it to Paywall page, you use this code to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $('#sqs-paywall-page-root').closest('body').addClass('paywall-body');
    $("body.paywall-body a.btn").html(function() { 
          return $(this).html().replace("Contact Us", "new text");  
    });
  $("body.paywall-body a.btn").attr('href','https://google.com');
});
</script>
2 Likes