Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Update WooCommerce Cart

add_action( 'wp_footer', 'bbloomer_cart_refresh_update_qty', 9999 );

function bbloomer_cart_refresh_update_qty() {
     if ( is_cart() || ( is_cart() && is_checkout() ) ) {
          ?>
          <style type="text/css">
            input[name='update_cart'] {
                display: none !important;
            }
             /* OR TRY THIS */
 
	     button[name='update_cart']
            {display: none !important;}
        </style>
        <script type="text/javascript">
	jQuery('div.woocommerce').on('change', 'input.qty', function(){
	     jQuery("[name='update_cart']").removeAttr('disabled').attr('aria-disabled','false').trigger("click");
});
       </script>
	<?php

	}
}
Comment

update cart subtotal woocommerce

add_action( 'woocommerce_before_calculate_totals', 'add_custom_price', 10, 1);
function add_custom_price( $cart_object ) {

    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 )
        return;

    foreach ( $cart_object->get_cart() as $cart_item ) {
        ## Price calculation ##
        $price = $cart_item['data']->price * 12;

        ## Set the price with WooCommerce compatibility ##
        if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
            $cart_item['data']->price = $price; // Before WC 3.0
        } else {
            $cart_item['data']->set_price( $price ); // WC 3.0+
        }
    }
}
Comment

auto update cart on woocommerce

add_filter( 'wcauc_input_trigger', 'wcauc_update_trigger_function' );
function wcauc_update_trigger_function( $trigger ) {
    return '.your-class-here';
}
Comment

PREVIOUS NEXT
Code Example
Php :: include blade file in laravel 
Php :: php get slug 
Php :: wordpress enqueue js 
Php :: php stop loading page 
Php :: faker image laravel 8 
Php :: laravel list of models 
Php :: php date list 
Php :: get query string in symfony twig 
Php :: url segment in laravel 
Php :: error 500 internal server error in laravel 
Php :: custom timestamp column laravel 
Php :: php print object 
Php :: acf get image id sub_field 
Php :: symfony rabbitMQ 
Php :: php http method 
Php :: picture on picture php 
Php :: how to deploy laravel windows 
Php :: rule for radio button in laravel 
Php :: Hide Categories - Woocommerce Product Page 
Php :: how run all seeder at once in laravel 
Php :: execute function php 
Php :: Prevent direct url access to php file 
Php :: dd php 
Php :: php if input is empty 
Php :: add key value array php 
Php :: php integer 
Php :: new static laravel 
Php :: get all error message in array form laravel validation in laravel 
Php :: comment split une chaine de caratere en php 
Php :: php dirname 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =