Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix from 36c220f
  • Loading branch information
mikejolley committed Feb 20, 2019
1 parent c840f2f commit 359d113
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -560,9 +560,13 @@ public function sync_price( &$product ) {
global $wpdb;

$children = $product->get_visible_children();
$format = array_fill( 0, count( $children ), '%d' );
$query_in = '(' . implode( ',', $format ) . ')';
$prices = $children ? array_unique( $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_price' AND post_id IN {$query_in}", $children ) ) : array(); // @codingStandardsIgnoreLine.
if ( $children ) {
$format = array_fill( 0, count( $children ), '%d' );
$query_in = '(' . implode( ',', $format ) . ')';
$prices = array_unique( $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_price' AND post_id IN {$query_in}", $children ) ) ); // @codingStandardsIgnoreLine.
} else {
$prices = array();
}

delete_post_meta( $product->get_id(), '_price' );
delete_post_meta( $product->get_id(), '_sale_price' );
Expand Down

0 comments on commit 359d113

Please sign in to comment.