All prices now shown with VAT included: - Cost: converted using wc_get_price_including_tax() - Your Price: already tax-inclusive - Suggested: from Google, always tax-inclusive Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 the Google Merchant 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 API Integration: Uses the new Google Merchant API (replaces deprecated Content API)
- No External Dependencies: Self-contained plugin with no Composer requirements
- 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
- PHP OpenSSL extension (for JWT authentication)
- Google Merchant Center account
- Google Service Account with Merchant API access
Installation
- Download the plugin
- Upload to
/wp-content/plugins/informatiq-smart-google-pricing/ - Activate the plugin through the 'Plugins' menu in WordPress
- Configure settings under WooCommerce > Smart Pricing
No Composer or external dependencies required - the plugin is fully self-contained.
Configuration
Google Merchant Center Setup
- Create a Google Cloud Project
- Enable the Merchant API
- 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 competitive pricing data from Google's Price Competitiveness reports
- 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
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
├── languages/
├── informatiq-smart-google-pricing.php
├── README.md
└── uninstall.php
API Notes
This plugin uses the new Google Merchant API which replaces the deprecated Content API for Shopping. Key differences:
- Base URL:
https://merchantapi.googleapis.com - Pricing: Amounts are in micros (1,000,000 micros = 1 unit of currency)
- Resource naming: Uses hierarchical names like
accounts/{id}/products/{product}
Support
For support and documentation, visit informatiq.services
Author
Mălin Cenușă
- Website: malin.ro
- Company: informatiq.services
License
GPL v2 or later
Changelog
2.0.0
- Migrated to Google Merchant API (from deprecated Content API)
- Removed Composer/vendor dependencies
- Self-contained plugin with direct REST API calls
- JWT-based authentication using PHP OpenSSL
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