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
}
}
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+
}
}
}
add_filter( 'wcauc_input_trigger', 'wcauc_update_trigger_function' );
function wcauc_update_trigger_function( $trigger ) {
return '.your-class-here';
}