Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wp wc php if cart page is empty redirect

add_action("template_redirect", 'redirection_function');
function redirection_function(){
    global $woocommerce;
    if( is_cart() && WC()->cart->cart_contents_count == 0){
        wp_safe_redirect( get_permalink( woocommerce_get_page_id( 'shop' ) ) );
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: seconds to minutes php 
Php :: when image update laravel delete remove image 
Php :: base64 decode in php 
Php :: laravel blade if variable exist 
Php :: php timezone for manila 
Php :: how to install php fm 
Php :: laravel send back with message 
Php :: laravel collection flatten 
Php :: fopen(F:xampphtdocsEscubydustoragefonts//themify_normal_f60486608aadd4e36c92c9895f99838f.ufm): failed to open stream: No such file or directory 
Php :: php echo html response code 200 
Php :: redirect in codeigniter 
Php :: laravel rename column name 
Php :: array merge laravel 
Php :: laravel eloquent search query 2020 
Php :: eloquent cast date 
Php :: php get method name 
Php :: php remove first and last char 
Php :: laravel check if eloquent just created 
Php :: foreach loop in blade code 
Php :: pre_r 
Php :: php ping test 
Php :: get taxonomy term id from slug - WordPress 
Php :: how add confirmation box in php before deleting 
Php :: php get hour 
Php :: unique validation on update laravel 
Php :: get contents of a tmp file php 
Php :: php sleep half a second 
Php :: group users on country vice in laravel 
Php :: Laravel validation for checkboxes 
Php :: laravel makehidden 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =