Omnibus Directive: Reference to update the Omnibus Directive product price logs programmatically
Reference to update the Omnibus Directive product price logs programmatically: Guidelines for updating product price logs according to the Omnibus Directive programmatically.
/**
* Reference to update the Omnibus Directive product price logs programmatically
* The current price has the current lowest price
* The history price has the preview lowest price
* NOTE: The history prices will be deleted after 30 days (based on your Omnibus Directive addons settings configuration)
*/
global $product;
$product_id = $product->get_id();
$updated_price = 10; //Example for updated price
$wdr_od_price_updated_history = [
'price' => $updated_price,
'timestamp' => current_time('timestamp', true),
];
$wdr_od_price_updated_current = [
'price' => $updated_price,
'timestamp' => current_time('timestamp', true),
];
//Here you can update the Omnibus Directive product price current and history logs
update_post_meta($product_id, '_wdr_od_price_history', $wdr_od_price_updated_history);
update_post_meta($product_id, '_wdr_od_price_current', $wdr_od_price_updated_current);