Merge pull request #6559 from tamarazuk/non-integer-stock

Allow for non-integer stock quantities
This commit is contained in:
Mike Jolley 2014-10-17 11:40:18 +01:00
commit c69c34baa6
1 changed files with 3 additions and 3 deletions

View File

@ -182,13 +182,13 @@ class WC_Product {
// Update stock in DB directly
switch ( $mode ) {
case 'add' :
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = meta_value + %d WHERE post_id = %d AND meta_key='_stock'", $amount, $this->id ) );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = meta_value + %f WHERE post_id = %d AND meta_key='_stock'", $amount, $this->id ) );
break;
case 'subtract' :
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = meta_value - %d WHERE post_id = %d AND meta_key='_stock'", $amount, $this->id ) );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = meta_value - %f WHERE post_id = %d AND meta_key='_stock'", $amount, $this->id ) );
break;
default :
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %d WHERE post_id = %d AND meta_key='_stock'", $amount, $this->id ) );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %f WHERE post_id = %d AND meta_key='_stock'", $amount, $this->id ) );
break;
}