=== Competitor Price Comparison ===
Contributors: gavinedley
Tags: price comparison, repricer, auto repricer, woocommerce repricer, repricing software
Requires at least: 6.5
Tested up to: 6.9
Requires PHP: 8.2
Stable tag: 1.7.0
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Scrapes competitor websites, maps items, compares offerings, and adjusts pricing based on rules.

== Description ==

The **Competitor Price Comparison** plugin allows WooCommerce store owners to automatically adjust their product prices based on competitors' pricing. It scrapes competitor websites, maps your products to theirs, compares offerings, and adjusts your pricing according to customizable rules.

**Key Features:**

- **Automated Competitor Price Scraping:** Fetch competitor prices directly from their websites.
- **Product Mapping:** Map your WooCommerce products to competitor products for accurate comparisons.
- **Customizable Pricing Rules:** Set rules to adjust your prices based on competitor data (e.g., undercut by percentage or fixed amount).
- **Minimum and Maximum Price Thresholds:** Ensure your prices stay within acceptable ranges.
- **Scheduled Price Updates:** Use WordPress cron to schedule regular price updates.
- **Support for Multiple Competitors:** Add and manage multiple competitor sources.
- **Action Scheduler Integration:** Efficiently handle batch processing of product updates.
- **Detailed Logging:** Keep track of pricing adjustments and scraping activities.

== Installation ==

1. **Upload Plugin Files:**

   - Upload the `competitor-price-comparison` folder to the `/wp-content/plugins/` directory.
   - Alternatively, install the plugin through the WordPress plugins screen directly by searching for "Competitor Price Comparison."

2. **Activate the Plugin:**

   - Activate the plugin through the 'Plugins' screen in WordPress.

3. **Configure Settings:**

   - Navigate to **Settings > Competitor Price Comparison** to configure the plugin.
   - Enter your Scraper API key in the plugin settings.
   - Add your competitors by specifying their websites and the CSS selectors needed to scrape product titles and prices.

4. **Map Products:**

   - Use the product mapping interface to associate your WooCommerce products with competitor products.
   - You can perform bulk mappings or individual product mappings.

5. **Set Up Pricing Rules:**

   - Define your pricing strategy by setting undercut methods (percentage, fixed amount, or both).
   - Configure minimum and maximum price thresholds to protect your margins.

6. **Schedule Price Updates:**

   - Set the update interval for automatic price adjustments (e.g., hourly, daily).
   - Ensure your WordPress cron is functioning properly for scheduled tasks.

== External Services ==

This plugin relies on **external/third-party services** to obtain competitor information and/or facilitate scraping. Specifically:

**ScraperAPI**  
   - **What is it used for?**  
     This service renders competitor pages or product URLs, allowing the plugin to scrape product titles and prices.  
   - **What data is sent?**  
     When a scraping event (such as an update or “Test Selector”) occurs, the plugin sends the competitor product URL to ScraperAPI’s endpoint.  
   - **When is data sent?**  
     Data is transmitted whenever you manually trigger a “test” (e.g., in the plugin’s admin UI) or when the scheduled pricing update runs in the background to fetch competitor pages.  
   - **Domain:**  
     `https://api.scraperapi.com`  
   - **Terms of Service & Privacy Policy:**  
     - [ScraperAPI Terms](https://www.scraperapi.com/terms?fp_ref=gavin69)  
     - [ScraperAPI Privacy Policy](https://www.scraperapi.com/privacy/?fp_ref=gavin69)  

Please note it is your responsibility to review and comply with these services’ Terms of Use and Privacy Policies.  

== Frequently Asked Questions ==

= Does this plugin work with any WooCommerce store? =

Yes, the Competitor Price Comparison plugin is designed to work with any WooCommerce store running WordPress version 6.5 or higher.

= How do I add competitors? =

Navigate to **Settings > Competitor Price Comparison** and add competitor websites along with the necessary CSS selectors to scrape product titles and prices.

= How do I map my products to competitor products? =

Use the product mapping interface provided by the plugin to associate your products with those of your competitors. You can perform bulk mappings using SKU matching or map products individually.

= Can I set minimum and maximum price thresholds? =

Yes, you can define minimum and maximum price thresholds in the pricing rules settings to ensure your prices stay within acceptable ranges.

= How often does the plugin update prices? =

You can configure the update interval in the plugin settings. Options include every 12 hours, daily, every 2 days, weekly, and monthly. More frequent intervals are not currently offered in order to help manage the Action Scheduler load efficiently and to avoid excessive resource consumption for larger catalogue sizes.

= Is there a risk of being blocked by competitor websites? =

Scraping websites may violate their terms of service and could result in being blocked. Use this plugin responsibly and ensure compliance with all applicable laws and regulations.

= What happens if a competitor changes their website structure? =

If a competitor changes their website structure or the CSS selectors used to scrape data, you will need to update the selectors in the plugin settings to continue fetching accurate data.

= Does the plugin support variable products? =

Currently, the plugin primarily supports simple products. Support for variable products may be limited.

= Can I undo price changes made by the plugin? =

The plugin updates product prices based on your settings. It's recommended to back up your database before making bulk changes. You can adjust pricing rules to revert changes or manually update product prices as needed.

= How do I ensure the plugin doesn't overload my server? =

The plugin includes mechanisms like action limiting and lock mechanisms to prevent overloading your server or the Action Scheduler. Ensure you configure these settings appropriately in the plugin.

= Is technical support available? =

For support, please contact the plugin author at info@woocommercerepricer.com.

== Changelog ==

= 1.6.9 =
* Fixed bulk mapping bug that caused mappings to not save when fuzzy match was made 

= 1.6.8 =
* Introduced new support tab and walkthrough guidance

= 1.6.7 =
* Introduced more robust repricing mechanism to handle multi currency

= 1.6.6 =
* Fixed issue with comma-based pricing thousandth decimal

= 1.6.5 =
* Fixed issue with comma-based scraped pricing not being processed accurately

= 1.6.4 =
* Fixed fatal error with PhpSpreadsheet 2.0 (replaced deprecated helpers)

= 1.6.3 =
* Improved batch processing performance.
* Added lock mechanism to prevent overlapping processes.
* Fixed issue with undercut pricing rules not updating correctly.
* Enhanced logging for better debugging and monitoring.

= 1.6.2 =
* Enhanced product mapping functionality.
* Fixed bugs related to competitor data fetching.
* Improved compatibility with the latest version of WooCommerce.

= 1.6.1 =
* Added support for multiple competitors.
* Implemented Action Scheduler for better task management.
* Improved error handling during scraping.

= 1.6.0 =
* Initial release with core functionality:
  - Competitor scraping.
  - Product mapping.
  - Basic pricing rules.

== Upgrade Notice ==

= 1.6.3 =
Please update to the latest version to benefit from performance improvements, new features, and important bug fixes.

== License ==

This plugin is licensed under the GNU General Public License v2.0 or later.

== Notes ==

- **Disclaimer:** Use this plugin responsibly and ensure compliance with all applicable laws and regulations regarding data scraping and competition.
- **Support:** For any issues or questions, please contact the plugin author.

== Credits ==

- **Author:** Gavin Edley
- **Contributors:** Thank you to all contributors and testers who have helped improve this plugin.

