public static function resetProductsToMaxPrice($items = false, $verbose = false) { $items = $items ? $items : WPLA_ListingQueryHelper::getItemsWithoutLowestPriceButPriceLowerThanMaxPrice(); $changed_product_ids = array(); // loop found listings foreach ($items as $item) { // make sure there is a max_price but no lowest price if (!$item->post_id) { continue; } if (!$item->min_price) { continue; } if (!$item->max_price) { continue; } if ($item->lowest_price) { continue; } // target price is max price $target_price = $item->max_price; if ($verbose) { wpla_show_message($item->sku . ': No BuyBox price, no competitor - falling back to Max Price: ' . $target_price); } // update price $price_was_changed = self::updateAmazonPrice($item, $target_price, $verbose); if ($price_was_changed) { $changed_product_ids[] = $item->post_id; } WPLA()->logger->info('resetProductsToMaxPrice() - new price for #' . $item->sku . ': ' . $target_price); } // foreach item return $changed_product_ids; }