Informatiq Smart Google Pricing
A production-ready WooCommerce plugin that automatically adjusts sale prices based on Google Merchant Center competitor data.
Description
This plugin connects to Google Merchant Center API to retrieve competitive pricing data and automatically updates your WooCommerce product prices to stay competitive while maintaining your desired profit margins.
Features
- Automated Daily Price Updates: Schedule automatic price adjustments using WordPress cron
- Google Merchant Center Integration: Connects via Google Content API for Shopping
- Tax-Aware Pricing: Handles both tax-inclusive and tax-exclusive pricing configurations
- Minimum Margin Protection: Never sell below your cost + minimum margin
- In-Stock Only Processing: Only updates products that are currently in stock
- Comprehensive Logging: Track all price changes with detailed logs
- Manual Sync: Test and trigger price updates manually from the admin panel
- WooCommerce Cost of Goods Support: Uses product cost data for margin calculations
Requirements
- WordPress 5.8 or higher
- WooCommerce 5.0 or higher
- PHP 7.4 or higher
- Google Merchant Center account
- Google Service Account with Content API access
Installation
Quick Install (Recommended)
- Download the plugin with vendor libraries included (complete package)
- Upload to
/wp-content/plugins/informatiq-smart-google-pricing/ - Activate the plugin through the 'Plugins' menu in WordPress
- Configure settings under WooCommerce > Smart Pricing
Manual Setup (If vendor directory is missing)
- Upload the plugin files to
/wp-content/plugins/informatiq-smart-google-pricing/ - Set up Google API Client library (see
VENDOR-SETUP.mdfor details):- Option A: Run
composer installin the plugin directory - Option B: Manually download and extract Google API Client to
vendor/directory
- Option A: Run
- Activate the plugin through the 'Plugins' menu in WordPress
- Configure settings under WooCommerce > Smart Pricing
The plugin includes a custom autoloader that works with manually included libraries, so Composer is not required for end users.
Configuration
Google Merchant Center Setup
- Create a Google Cloud Project
- Enable the Content API for Shopping
- Create a Service Account and download the JSON key
- Grant the service account access to your Merchant Center account
Plugin Settings
- Navigate to WooCommerce > Smart Pricing
- Enter your Google Merchant ID
- Paste your Service Account JSON key
- Set your minimum profit margin percentage
- Configure automation settings
- Save settings and test the connection
How It Works
- Daily Automation: The plugin runs automatically based on your configured schedule
- Product Matching: Matches WooCommerce products with Google Merchant Center via SKU/GTIN
- Competitive Analysis: Retrieves the lowest competitor price from Google
- Price Calculation:
- Calculates new price as: Competitor Price - Random Offset (0.05-0.20)
- Ensures price never goes below Cost + Minimum Margin
- Handles tax calculations based on WooCommerce settings
- Price Update: Updates the product sale price in WooCommerce
- Logging: Records all changes for auditing and review
Tax Handling
The plugin intelligently handles both pricing configurations:
- Prices Include Tax: Sets sale price directly to match desired final price
- Prices Exclude Tax: Reverse-calculates base price to achieve desired final price after tax
Minimum Margin Protection
The plugin ensures profitability by:
- Checking product cost from WooCommerce Cost of Goods (
_wc_cog_costmeta) - Falling back to regular price if cost is not set
- Calculating minimum price as:
Cost × (1 + Minimum Margin %) - Never setting prices below this minimum threshold
Admin Interface
Access the admin panel at WooCommerce > Smart Pricing to:
- Configure Google API credentials
- Set pricing rules and margins
- Test API connection
- Run manual price syncs
- View sync schedule and status
- Review today's price updates
- Monitor logging and errors
Logging
All price updates are logged with:
- Product ID and name
- Old and new prices
- Competitor price
- Timestamp
- Update message
Logs are stored in a custom database table and also written to WooCommerce logs for debugging.
Cron Schedule
The plugin supports multiple update frequencies:
- Once daily (default)
- Twice daily (every 12 hours)
- Every 6 hours
Development
File Structure
informatiq-smart-google-pricing/
├── admin/
│ └── class-informatiq-sp-admin.php
├── assets/
│ ├── css/
│ │ └── admin.css
│ └── js/
│ └── admin.js
├── includes/
│ ├── class-informatiq-sp-google-api.php
│ ├── class-informatiq-sp-logger.php
│ ├── class-informatiq-sp-price-updater.php
│ └── class-informatiq-sp-scheduler.php
├── composer.json
├── informatiq-smart-google-pricing.php
├── README.md
└── uninstall.php
Dependencies
The plugin uses Composer for dependency management:
composer install
Main dependencies:
google/apiclient: ^2.15
Support
For support and documentation, visit informatiq.services
Author
Mălin Cenușă
- Website: malin.ro
- Company: informatiq.services
License
GPL v2 or later
Changelog
1.0.0
- Initial release
- Google Merchant Center integration
- Automated daily price updates
- Tax-aware pricing logic
- Minimum margin protection
- Comprehensive logging
- Admin interface with manual sync