This snippet allows you to remove the header from your checkout page. Why do this? Well, you’ll know from our Conversion Rate Optimisation (CRO) course that plenty of people will abandon your checkout. One of the reasons for this abandonment is the customer gets distracted. The header is just one of these distractions and likely contains your navigation menu which has many links. Each link being a distraction and somewhere else the customer can navigate to. On the checkout, the aim is to get the customer to pay and not navigate away. Specifically, this snippet checks the user is on the checkout page and if so, hides the header using CSS. Technically, the Thank You page too is the checkout page, just a different endpoint (the order-received endpoint to be exact. Not to worry though, this snippet ensures the header is shown on the thank you page due to the conditional logic included in the if statement.
/**
* Snippet Name: WooCommerce Remove Header On Checkout
* Snippet Author: ecommercehints.com
*/
function ecommercehints_remove_header_on_checkout() {
if(is_checkout() && !is_wc_endpoint_url( 'order-received' )){ // Remove from checkout but show again on the thank you page ?>