@@ 379-404 (lines=26) @@ | ||
376 | ", current_time( 'timestamp' ) ) ); |
|
377 | ||
378 | if ( $product_ids ) { |
|
379 | foreach ( $product_ids as $product_id ) { |
|
380 | $sale_price = get_post_meta( $product_id, '_sale_price', true ); |
|
381 | ||
382 | if ( $sale_price ) { |
|
383 | update_post_meta( $product_id, '_price', $sale_price ); |
|
384 | } else { |
|
385 | // No sale price! |
|
386 | update_post_meta( $product_id, '_sale_price_dates_from', '' ); |
|
387 | update_post_meta( $product_id, '_sale_price_dates_to', '' ); |
|
388 | } |
|
389 | ||
390 | $parent = wp_get_post_parent_id( $product_id ); |
|
391 | ||
392 | // Sync parent |
|
393 | if ( $parent ) { |
|
394 | // Clear prices transient for variable products. |
|
395 | delete_transient( 'wc_var_prices_' . $parent ); |
|
396 | ||
397 | // Grouped products need syncing via a function |
|
398 | $this_product = wc_get_product( $product_id ); |
|
399 | ||
400 | if ( $this_product->is_type( 'simple' ) ) { |
|
401 | $this_product->grouped_product_sync(); |
|
402 | } |
|
403 | } |
|
404 | } |
|
405 | ||
406 | delete_transient( 'wc_products_onsale' ); |
|
407 | } |
|
@@ 423-441 (lines=19) @@ | ||
420 | ", current_time( 'timestamp' ) ) ); |
|
421 | ||
422 | if ( $product_ids ) { |
|
423 | foreach ( $product_ids as $product_id ) { |
|
424 | $regular_price = get_post_meta( $product_id, '_regular_price', true ); |
|
425 | ||
426 | update_post_meta( $product_id, '_price', $regular_price ); |
|
427 | update_post_meta( $product_id, '_sale_price', '' ); |
|
428 | update_post_meta( $product_id, '_sale_price_dates_from', '' ); |
|
429 | update_post_meta( $product_id, '_sale_price_dates_to', '' ); |
|
430 | ||
431 | $parent = wp_get_post_parent_id( $product_id ); |
|
432 | ||
433 | // Sync parent |
|
434 | if ( $parent ) { |
|
435 | // Grouped products need syncing via a function |
|
436 | $this_product = wc_get_product( $product_id ); |
|
437 | if ( $this_product->is_type( 'simple' ) ) { |
|
438 | $this_product->grouped_product_sync(); |
|
439 | } |
|
440 | } |
|
441 | } |
|
442 | ||
443 | WC_Cache_Helper::get_transient_version( 'product', true ); |
|
444 | delete_transient( 'wc_products_onsale' ); |