I have set prices 7,09 and in cart it shows 7,00. How I can remove this rounding? I have custom variation price field.
My code:
woocommerce_wp_text_input(
array(
'id' => '_number_field[' . $variation->ID . ']',
'label' => __( 'Aluse hind', 'woocommerce' ),
'desc_tip' => 'true',
'description' => __( 'Sisesta aluse hind.', 'woocommerce' ),
'value' => get_post_meta( $variation->ID, '_number_field', true ),
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
)
)
);
add_filter('woocommerce_product_variation_get_price', 'custom_product_get_price', 10, 2 );
add_filter('woocommerce_show_variation_price', function() { return TRUE;});
function custom_product_get_price( $price, $product ){
if (!empty(get_post_meta( $product->get_id(), '_number_field', true))) {
return get_post_meta( $product->get_id(), '_number_field', true);
} else {
return get_post_meta( $product->get_id(), '_price', true);
}
}