From 6374a13d305e46f5ed89dba1af68330935ea6309 Mon Sep 17 00:00:00 2001 From: Caleb Burks <19caleb95@gmail.com> Date: Tue, 5 Dec 2017 00:53:52 -0600 Subject: [PATCH 1/2] =?UTF-8?q?Update=20a=20product=E2=80=99s=20modified?= =?UTF-8?q?=5Fdate=20for=20stock=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/wc-stock-functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/wc-stock-functions.php b/includes/wc-stock-functions.php index 14e08a8fb68..91d4bab12f4 100644 --- a/includes/wc-stock-functions.php +++ b/includes/wc-stock-functions.php @@ -43,6 +43,7 @@ function wc_update_product_stock( $product, $stock_quantity = null, $operation = // Re-read product data after updating stock, then have stock status calculated and saved. $product_with_stock = wc_get_product( $product_id_with_stock ); $product_with_stock->set_stock_status(); + $product_with_stock->set_date_modified( date() ); $product_with_stock->save(); do_action( $product_with_stock->is_type( 'variation' ) ? 'woocommerce_variation_set_stock' : 'woocommerce_product_set_stock', $product_with_stock ); From 54d4012c336ee210b11e5c277ce7dcf1a474da9c Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 7 Dec 2017 15:24:57 +0000 Subject: [PATCH 2/2] Use timestamp function --- includes/wc-stock-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-stock-functions.php b/includes/wc-stock-functions.php index 91d4bab12f4..3f27b280438 100644 --- a/includes/wc-stock-functions.php +++ b/includes/wc-stock-functions.php @@ -43,7 +43,7 @@ function wc_update_product_stock( $product, $stock_quantity = null, $operation = // Re-read product data after updating stock, then have stock status calculated and saved. $product_with_stock = wc_get_product( $product_id_with_stock ); $product_with_stock->set_stock_status(); - $product_with_stock->set_date_modified( date() ); + $product_with_stock->set_date_modified( current_time( 'timestamp', true ) ); $product_with_stock->save(); do_action( $product_with_stock->is_type( 'variation' ) ? 'woocommerce_variation_set_stock' : 'woocommerce_product_set_stock', $product_with_stock );