Wordpress 仅当用户选择多个产品时才查看购物车页面
我只想在用户选择多个产品时查看购物车页面,否则我想直接将其重定向到结帐页面。Wordpress 仅当用户选择多个产品时才查看购物车页面,wordpress,woocommerce,Wordpress,Woocommerce,我只想在用户选择多个产品时查看购物车页面,否则我想直接将其重定向到结帐页面。 <?php // Add this code in header file. if(is_cart()){ global $woocommerce; $total = $woocommerce->cart->cart_contents_count; if($total<=1){ ?> <script&g
<?php
// Add this code in header file.
if(is_cart()){
global $woocommerce;
$total = $woocommerce->cart->cart_contents_count;
if($total<=1){
?>
<script>window.location="<?php echo esc_url(home_url('checkout'));?>";</script>
<?php
}
}
// Note: if You are selected 1 product 3 times the above code is not working.
?>
window.location=“”;