Replace dot by comma in fee column
-
Hi! I love your plugin, congrats! My english is too bad, sorry! Im charging an extra fee in some orders according with this post:
https://docs.woocommerce.com/document/add-a-surcharge-to-cart-and-checkout-uses-fees-api/
/** * Add a 1% surcharge to your cart / checkout * change the $percentage to set the surcharge to a value to suit */ add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' ); function woocommerce_custom_surcharge() { global $woocommerce; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; $percentage = 0.01; $surcharge = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total ) * $percentage; $woocommerce->cart->add_fee( 'Surcharge', $surcharge, true, '' ); }When I’m export that field I’m receiving value but in dot decimal format. Im tried to change by a comma with this two ways:
https://ww.wp.xz.cn/support/topic/string-replace-2/
add_filter( 'woe_format_numbers', function($new_value, $value) { return number_format( floatval( $value ), 2, ".","" ); },10,2);https://ww.wp.xz.cn/support/topic/replace-the-dot-with-a-comma/
add_filter('woe_get_order_value_fee_deeb1249643c4cee63e00ef8084468e2', function ($value, $order, $fieldname) { return str_replace( ".", ",", $value); }, 10, 3);I’ve replaced total_weight_items by fee_deeb1249643c4cee63e00ef8084468e2 because is the field title, but not working. Any help please? Thanks in advance!
The topic ‘Replace dot by comma in fee column’ is closed to new replies.