Skip to content

Commit 16ca009

Browse files
rithikb24facebook-github-bot
authored andcommitted
integrate last change time into external_update_time calculation (facebook#3577)
Summary: Rollback Plan: Differential Revision: D81231380
1 parent 718d274 commit 16ca009

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

includes/fbproduct.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,9 +2246,17 @@ public function prepare_product( $retailer_id = null, $type_to_prepare_for = sel
22462246
$product_data['gtin'] = $this->woo_product->get_global_unique_id();
22472247
}
22482248

2249-
if ( $this->woo_product->get_date_modified() ) {
2250-
$date_modified = $this->woo_product->get_date_modified();
2251-
$product_data['external_update_time'] = $date_modified->getTimestamp();
2249+
$date_modified = $this->woo_product->get_date_modified();
2250+
if ( $date_modified ) {
2251+
$external_update_time = (int) $date_modified->getTimestamp();
2252+
$last_change_time = (int) $this->woo_product->get_meta( '_last_change_time' );
2253+
2254+
// Use the newer timestamp if _last_change_time is valid, otherwise use external_update_time
2255+
if ( $last_change_time > 0 ) {
2256+
$product_data['external_update_time'] = max( $external_update_time, $last_change_time );
2257+
} else {
2258+
$product_data['external_update_time'] = $external_update_time;
2259+
}
22522260
}
22532261

22542262
// Only use checkout URLs if they exist.

0 commit comments

Comments
 (0)