Untitled

mail@pastecode.io avatar
unknown
plain_text
3 months ago
1.7 kB
12
Indexable

add_action('wp_head', function(){
	?>
	<style type="text/css">
		.b2bking_cream_input_group .b2bking_bulkorder_form_container_content_line_qty_indigo.b2bking_bulkorder_form_container_content_line_qty.b2bking_bulkorder_form_container_content_line_qty_cream {
		    width: 55px !important;
		}
	</style>
	<?php
});

add_filter('b2bking_minmaxstep_val', function($val){
	return 0.1;
}, 10, 1);
add_filter('b2bking_bulkorder_cream_value_final', function($val){
    return 0.1;
}, 10, 1);
add_filter('b2bking_bulkorder_cream_min_final', function($val){
    return 0.1;
}, 10, 1);
add_filter('b2bking_bulkorder_cream_step_final', function($val){
    return 0.1;
}, 10, 1);

remove_filter('woocommerce_stock_amount', 'intval');
add_filter('woocommerce_stock_amount', 'floatval');
add_action('wp', 'customize_quantity_field');

// For Ajax add to cart button (define the min value)
add_filter( 'woocommerce_loop_add_to_cart_args', 'custom_loop_add_to_cart_quantity_arg', 10, 2 );
function custom_loop_add_to_cart_quantity_arg( $args, $product ) {
    $args['quantity'] = 0.1; // Min value
    return $args;
}
// For product variations (define the min value)
add_filter( 'woocommerce_available_variation', 'filter_wc_available_variation_price_html', 10, 3);
function filter_wc_available_variation_price_html( $data, $product, $variation ) {
    $data['min_qty'] = 0.1;
    return $data;
}
add_filter('b2bking_force_step_1','__return_false');

function customize_quantity_field() {
    add_filter('woocommerce_quantity_input_min', 'min_decimal');
    function min_decimal($val) {
        return 0.1;
    }
    
    add_filter('woocommerce_quantity_input_step', 'nsk_allow_decimal');
    function nsk_allow_decimal($val) {
        return 0.1;
    }        
}
Leave a Comment