Untitled
unknown
plain_text
a year ago
1.9 kB
2
Indexable
// Defined quantity arguments add_filter( 'woocommerce_quantity_input_args', 'custom_quantity_input_args', 9000, 2 ); function custom_quantity_input_args( $args, $product ) { if( ! is_cart() ) { $args['input_value'] = 0.01; // Starting value } $args['min_value'] = 0.01; // Minimum value $args['step'] = 0.01; // Quantity steps return $args; } // 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.01; // 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.01; return $data; } add_filter('b2bking_force_step_1','__return_false'); 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 }); remove_filter('woocommerce_stock_amount', 'intval'); add_filter('woocommerce_stock_amount', 'floatval'); add_action('wp', 'customize_quantity_field'); function customize_quantity_field() { // Add min value to the quantity field (default = 1) add_filter('woocommerce_quantity_input_min', 'min_decimal'); function min_decimal($val) { return 1; } // Add step value to the quantity field (default = 1) add_filter('woocommerce_quantity_input_step', 'nsk_allow_decimal'); function nsk_allow_decimal($val) { return 0.01; } }
Editor is loading...
Leave a Comment