Merge pull request #21333 from ediamin/conditional_check_for_float_type_product_meta

Ignore converting float meta value for registered post meta
This commit is contained in:
Claudiu Lodromanean 2018-09-19 09:42:06 -07:00 committed by GitHub
commit 3d2b0ab72b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -245,7 +245,7 @@ class WC_Post_Data {
wp_cache_delete( 'product-' . $object_id, 'products' ); wp_cache_delete( 'product-' . $object_id, 'products' );
} }
if ( ! empty( $meta_value ) && is_float( $meta_value ) && in_array( get_post_type( $object_id ), array_merge( wc_get_order_types(), array( 'shop_coupon', 'product', 'product_variation' ) ), true ) ) { if ( ! empty( $meta_value ) && is_float( $meta_value ) && ! registered_meta_key_exists( 'post', $meta_key ) && in_array( get_post_type( $object_id ), array_merge( wc_get_order_types(), array( 'shop_coupon', 'product', 'product_variation' ) ), true ) ) {
// Convert float to string. // Convert float to string.
$meta_value = wc_float_to_string( $meta_value ); $meta_value = wc_float_to_string( $meta_value );