Echo Woocommerce Logout url Custom Development

WooCommerce is the most popular ecommerce plugin in the WordPress buy and sell products platform. WooCommerce doesn’t show if Logout url on top menu bar.

Echo Woocommerce Logout url Custom Development

I show this how you can echo logout url link very easy a short line of code, also I provide if else statement that user is logged in or not to your eCommerce site.

Echo logout url();

<?php 
echo wp_logout_url();
?>

User login or not check

This simply check weather user login or not, if user login show logout or else show login user.

<?php
// Check user login or not
if ( is_user_logged_in() ) {
    // if login show logout
    echo'<a href="'.wp_logout_url().'">Logout</a>';
    }
    else{
        // not user login show register
        echo'<a href="'.wp_login_url().'">Login/Registration</a>';
    }
?>

You can exactly to add this on function also with jQuery, and make custom development for your project.

This above code work perfect, I am already use this on my projects, for simple logout url added into php file or some modify you can use it with functions file also.

Leave a Reply

Your email address will not be published. Required fields are marked *