Fix sale expiration for variations. Closes #3321.
@coenjacobs might be useful for .13
This commit is contained in:
parent
7b38ad6d77
commit
f8f3f8a660
|
@ -235,10 +235,8 @@ class WC_Product_Variable extends WC_Product {
|
|||
public function get_price_html( $price = '' ) {
|
||||
|
||||
// Ensure variation prices are synced with variations
|
||||
if ( $this->min_variation_price === '' || $this->min_variation_regular_price === '' || $this->price === '' ) {
|
||||
if ( $this->min_variation_price === '' || $this->min_variation_regular_price === '' || $this->price === '' )
|
||||
$this->variable_product_sync();
|
||||
$this->price = $this->min_variation_price;
|
||||
}
|
||||
|
||||
// Get the price
|
||||
if ( $this->price > 0 ) {
|
||||
|
@ -499,7 +497,9 @@ class WC_Product_Variable extends WC_Product {
|
|||
}
|
||||
}
|
||||
|
||||
update_post_meta( $this->id, '_price', $this->min_variation_price );
|
||||
$this->price = $this->min_variation_price;
|
||||
|
||||
update_post_meta( $this->id, '_price', $this->price );
|
||||
update_post_meta( $this->id, '_min_variation_price', $this->min_variation_price );
|
||||
update_post_meta( $this->id, '_max_variation_price', $this->max_variation_price );
|
||||
update_post_meta( $this->id, '_min_variation_regular_price', $this->min_variation_regular_price );
|
||||
|
|
|
@ -2504,7 +2504,7 @@ function woocommerce_scheduled_sales() {
|
|||
// Sync parent
|
||||
if ( $parent ) {
|
||||
// We can force varaible product price to sync up by removing their min price meta
|
||||
delete_post_meta( $parent, 'min_variation_price' );
|
||||
delete_post_meta( $parent, '_min_variation_price' );
|
||||
|
||||
// Grouped products need syncing via a function
|
||||
$this_product = get_product( $product_id );
|
||||
|
@ -2545,7 +2545,7 @@ function woocommerce_scheduled_sales() {
|
|||
// Sync parent
|
||||
if ( $parent ) {
|
||||
// We can force variable product price to sync up by removing their min price meta
|
||||
delete_post_meta( $parent, 'min_variation_price' );
|
||||
delete_post_meta( $parent, '_min_variation_price' );
|
||||
|
||||
// Grouped products need syncing via a function
|
||||
$this_product = get_product( $product_id );
|
||||
|
|
Loading…
Reference in New Issue