Support » Plugin: WooCommerce » Variable product parent price doesn't update during wp-cron schedule

  • Resolved kyleduncan



    I’ve found a bug inside the wc_scheduled_sales() function in /includes/wc-product-functions.php (starts at line 358) wherein the following meta data is not updated automatically on the parent product when a sale starts via a cron task for variable products:

    1. _min_variation_price
    2. _max_variation_price
    3. _price

    The case in question is where a product has 4 sizes, all priced the same at £105.00, and the sale price for all 4 sizes is also the same across the board: £95. So once the sale is active, the main product page should show the sale price using the meta fields listed above. Instead, because these fields aren’t updated in the cron task, the original price still shows, until a manual “Update” of the product’s page in wordpress.

    I’ve investigated a bit further, and see on line 391 there’s a comment about syncing prices up to the variable parent product by deleting the _min_price_variation_id from the parent, but this delete doesn’t seem to do anything other than delete that meta field. To demonstrate, I have taken some screenshots of the SQL rows in question in the following 3 states:

    1. Before the sale has started (all ok)
    2. After the sale has started via the woocommerce_scheduled_sales cron task (each variation has been updated with the correct _price data (£95), but the parent product has not been updated at all, even though the _min_price_variation_id has been deleted from the parent. All three fields mentioned above still show £105 on the parent)
    3. After a manual “Update” in wordpress on the product in question (all is ok again and the three meta fields on the parent are now correct at £95)

    Can anybody help, and can i send the screengrabs if that will help show the problem?


Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Variable product parent price doesn't update during wp-cron schedule’ is closed to new replies.