Answers for "button display on condition woocommerce"

PHP
0

button display on condition woocommerce

<script>
jQuery(document).ready(function($){

   if ( $( '#step-1' ).hasClass( 'active' ) ) {
         $( '.button-prev' ).hide();
   }

   $("#action-next").click(function(){

         $( '.button-prev' ).show();

         if ( $( '#step-3' ).hasClass( 'active' ) ) {
               $( '.button-next' ).hide();
         } else {
               $( '.button-next' ).show();
         }
   });

   $("#action-prev").click(function(){

       $( '.button-next' ).show();

       if ( $( '#step-1' ).hasClass( 'active' ) ) {
              $( '.button-prev' ).hide();
       }
   });

});
</script>
Posted by: Guest on February-24-2021
0

button display on condition woocommerce

add_action('wp_head','thwmscf_hide_next_button');
function thwmscf_hide_next_button(){
 if(is_checkout()){
   $have_category = false;

   foreach ( WC()->cart->get_cart() as $item_key => $item_value ){
     $_product = $item_value['data'];
     $product_id = $_product->get_id();

     if(has_term( 'category_name', 'product_cat', $product_id)){
       $have_category = true;
     }  
   }

   if(!$have_category){
     ?>
     <style type="text/css">
       .thwmscf-buttons .button-next{
         display: none !important;
       }
     </style>
     <?php
   }
 }
}
Posted by: Guest on February-24-2021

Code answers related to "button display on condition woocommerce"

Browse Popular Code Answers by Language