Alap Woocommerce webshopban nincs lehetőség tizedes mennyiség rendelésre, pedig pl.: hús rendelés esetén nem egész mennyiség rendelését is meg kell oldani. A codeontrack.com-on találtam egy egyszerű megoldást amivel bővítmény nélkül orvosolhatjuk ezt a hiányosságot.
A sablonunk functions.php fájljába kell bemásolni a következő sorokat:
// Add min value to the quantity field (default = 1)add_filter('woocommerce_quantity_input_min', 'min_decimal');function min_decimal($val) { return 0.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.1;}// Removes the WooCommerce filter, that is validating the quantity to be an intremove_filter('woocommerce_stock_amount', 'intval');// Add a filter, that validates the quantity to be a floatadd_filter( 'woocommerce_stock_amount', 'floatval' );Forrás:
http://codeontrack.com/use-decimal-in-quantity-fields-in-woocommerce-wordpress/


Nincsenek megjegyzések:
Megjegyzés küldése