Skip to content

parhamfa/wp-product-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Product Sync WordPress Plugin

A WordPress plugin that allows you to sync product prices and quantities between two WordPress sites with WooCommerce. The plugin provides a comparison interface where you can review differences and selectively update products.

License: GPL v2 WordPress WooCommerce

Author: Parham Fatemi
Plugin URI: https://github.com/parhamfa/wp-product-sync

Features

  • 🔄 Chunked Data Fetching: Efficiently fetches large product catalogs without timeouts
  • 🎯 Advanced Product Matching: Multiple matching strategies (SKU, Product ID, Name, Partial Name, Normalized Name)
  • 📊 Comparison Interface: Side-by-side comparison with source product titles and IDs
  • ✅ Selective Updates: Choose which products to update with bulk selection options
  • 🧪 Dry Run Mode: Preview changes before applying them with detailed logging
  • 📈 Progress Tracking: Real-time progress bars with timing information for both fetching and updating
  • 🎨 Visual Indicators: Color-coded rows showing differences in prices and quantities
  • 📄 Pagination & Filtering: Navigate large datasets with filtering by status (same/different/no match/duplicates)
  • 🔍 Debug Mode: Detailed logging for troubleshooting and data validation
  • 💾 Data Persistence: Save and load configurations and results
  • ⚡ Chunked Updates: Process updates in batches to avoid server timeouts
  • 🔗 Source Links: Direct links to source products for verification
  • 📱 Responsive Design: Works on desktop and mobile devices

Requirements

  • WordPress 5.0 or higher
  • WooCommerce 3.0 or higher
  • PHP 7.4 or higher
  • Both sites must have WooCommerce REST API enabled

Installation

  1. Upload the product-sync folder to /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Go to 'Product Sync' in the WordPress admin menu

Setup Instructions

On the Source Site (the site you want to copy data from):

  1. Go to WooCommerce > Settings > Advanced > REST API
  2. Click Add Key
  3. Fill in the details:
    • Description: Product Sync API Key
    • User: Select an administrator user
    • Permissions: Read
  4. Click Generate API Key
  5. Copy the Consumer Key and Consumer Secret

On the Target Site (the site you want to update):

  1. Go to Product Sync in the admin menu
  2. Enter the source site configuration:
    • Source Site URL: The URL of your source WordPress site
    • Consumer Key: The consumer key from step 4 above
    • Consumer Secret: The consumer secret from step 4 above
  3. Click Test Connection to verify the setup
  4. Click Fetch Products to load data from the source site

Usage

  1. Fetch Data: After configuring the source site, click "Fetch Products" to load all products from the source site
  2. Review Comparison: The plugin will display a comparison table showing:
    • Current site products vs source site products
    • Price differences (highlighted in yellow)
    • Stock quantity differences (highlighted in red)
    • Match status (green for matched, red for no match)
  3. Select Products: Use the checkboxes to select which products you want to update
  4. Bulk Actions:
    • Select All: Select all matched products
    • Select None: Deselect all products
    • Select Different: Select only products with differences
  5. Dry Run: Click "Dry Run" to preview what changes will be made without actually updating
  6. Update: Click "Update Selected" to apply the changes

Product Matching

The plugin matches products between sites using the following priority:

  1. SKU Match: If both products have the same SKU
  2. Name Match: If product names match (case-insensitive)

Products that don't match are shown in red and cannot be selected for updates.

Security

  • All API requests use HTTPS
  • Consumer keys and secrets are stored securely
  • Nonce verification for all AJAX requests
  • User capability checks for admin functions

Troubleshooting

Connection Issues

  • Verify the source site URL is correct
  • Check that WooCommerce REST API is enabled on the source site
  • Ensure the API key has read permissions
  • Verify the source site is accessible from the target site

No Products Found

  • Check that both sites have published products
  • Verify WooCommerce is active on both sites
  • Ensure products have the correct visibility settings

Update Failures

  • Check user permissions on the target site
  • Verify WooCommerce is active and properly configured
  • Check for plugin conflicts

File Structure

product-sync/
├── product-sync.php              # Main plugin file
├── includes/
│   ├── class-product-sync.php    # Main plugin class
│   ├── class-api-client.php      # API client for fetching data
│   └── class-admin-interface.php # Admin interface
├── assets/
│   ├── css/
│   │   └── admin.css             # Admin styles
│   └── js/
│       └── admin.js              # Admin JavaScript
└── README.md                     # This file

Changelog

Version 1.0.1

  • 🔧 Fixed: Critical data source mismatch bug in product selection
  • ✨ Added: Advanced matching strategies (Product ID, Name variations)
  • ✨ Added: Chunked fetching and updating with progress tracking
  • ✨ Added: Pagination, filtering, and sorting capabilities
  • ✨ Added: Debug mode and detailed logging
  • ✨ Added: Data persistence for configurations and results
  • ✨ Added: Source product verification links
  • ✨ Added: Timing information and ETA calculations
  • 🎨 Improved: User interface with better visual indicators
  • 🎨 Improved: Error handling and user feedback

Version 1.0.0

  • Initial release
  • Basic product fetching and comparison
  • Dry run functionality
  • Bulk selection and update features

Support

For support and feature requests, please visit the GitHub repository or contact Parham Fatemi.

License

This plugin is licensed under the GPL v2 or later.

About

WordPress plugin to sync product prices and quantities between WooCommerce sites

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published