The S2S Image Linker plugin

Overview

YBO S2S Image Sync is a specialist WooCommerce plugin developed by YBO Digital to reconcile product images supplied through Stock2Shop with the images stored in the WordPress Media Library.

Stock2Shop may successfully synchronise product information, stock levels, pricing and image files, while the final WooCommerce featured-image and gallery assignments do not always remain aligned. This can result in empty galleries, outdated product images, incorrect image order or duplicate Media Library attachments created by repeated synchronisations.

YBO S2S Image Sync continuously compares each qualifying WooCommerce product with its current Stock2Shop image instructions. Products that already match are left unchanged. Genuine differences are corrected automatically, while incomplete or unsafe image matches are separated for review.

The plugin does not download new images from Stock2Shop. It identifies and assigns image files that already exist in the WordPress Media Library.

Why This Plugin Exists

Many WooCommerce stores connected to Stock2Shop experience one or more of the following problems:

Missing or Incomplete Product Galleries

A product may have a featured image while its additional gallery images have not been correctly attached.

The plugin identifies the complete Stock2Shop image set and assigns the correct featured image and gallery images in the required order.

Replaced or Rebranded Product Images

An empty-gallery scan cannot detect products that already contain images but whose current images have been replaced or rebranded.

YBO S2S Image Sync performs a full reconciliation rather than checking only empty galleries. It can therefore detect changes to:

• The featured image
• Gallery images
• Image order
• Added images
• Removed images
• Complete replacement image sets

Duplicate Media Library Images

Repeated Stock2Shop synchronisations can create several WordPress attachment records with the same image filename.

The plugin can treat the current Stock2Shop filename as authoritative, select the newest matching WordPress attachment and, where enabled, permanently remove verified lower-ID duplicate attachments after the product has been updated and checked.

Manual CSV Maintenance

Without automated reconciliation, gallery maintenance may require:
• Exporting image information
• Preparing CSV files
• Importing image assignments into WooCommerce
• Investigating missing galleries
• Repeating the process after catalogue changes

YBO S2S Image Sync removes this recurring manual workflow.

Large and Continuously Changing Catalogues

Maintaining product images manually becomes increasingly difficult as the catalogue grows.

The plugin uses WooCommerce Action Scheduler to process products gradually in the background, allowing large catalogues to be audited without placing unnecessary strain on WordPress, Stock2Shop or the hosting environment.

How The Plugin Works

The plugin uses the Stock2Shop API and the local WordPress Media Library to determine the correct image state for each WooCommerce product.

Step 1 – Product Identification

The WooCommerce product is identified through its SKU.

The Stock2Shop search process supports product codes and relevant variant identifiers so that products are not incorrectly excluded where the WooCommerce SKU relates to a Stock2Shop variant.

Step 2 – Retrieve the Stock2Shop Image Set

The plugin retrieves the current product-image instructions from Stock2Shop, including:
• Product or variant SKU
• Product images
• Expected image filenames
• Featured-image position
• Gallery-image order

Step 3 – Locate Existing WordPress Images

The plugin searches the WordPress Media Library for attachments matching the Stock2Shop image filenames.

No image upload is performed by the plugin. The required files must already exist in the Media Library through the existing Stock2Shop synchronisation process.

Step 4 – Resolve Duplicate Attachments

Where more than one WordPress attachment has the same Stock2Shop filename, the plugin applies the configured duplicate-handling policy.

Available policies include:
• Block the product for review
• Use the newest matching attachment
• Use the oldest matching attachment

For YBO-managed Stock2Shop installations, the newest attachment is generally preferred because repeated synchronisations typically create higher attachment IDs.

Step 5 – Verify the Complete Image Set

The plugin validates the entire expected image set before changing the product.

If an image is missing or cannot be safely resolved, the existing WooCommerce images remain unchanged and the product is recorded under Needs Review.

Step 6 – Update WooCommerce

The verified attachment IDs are assigned through WooCommerce’s product data system.

The plugin updates:
• The featured image
• Gallery images
• Gallery order

The product is then reloaded and checked to confirm that the expected image IDs were saved correctly.

Step 7 – Optional Duplicate Cleanup

Where permanent duplicate cleanup is enabled, lower-ID duplicate attachments are considered for deletion only after the product assignment has been successfully saved and verified.

Before deleting an attachment, the plugin confirms that:
• It is not used by another WooCommerce product
• It is not used as a variation image
• It does not share a physical file with the retained attachment
• The retained attachment still exists
• The current audit run and product lock remain valid

Verified superseded attachments are permanently removed from the Media Library and server, including their generated thumbnail files.

Step 8 – Record the Result

Every checked product is assigned to one of four clear result categories:
• Images Updated – the product image assignment was corrected
• No Change Required – the product was fully verified and already correct
• Needs Review – the product could not be safely reconciled
• Processing Errors – a technical or operational problem prevented completion

Synchronisation Methods

Manual Product Sync

Manual Sync is intended for a newly added, corrected or urgent product.

The administrator:
1. Enters one product SKU
2. Selects Check and Sync Product
3. Reviews the result

The plugin retrieves the Stock2Shop image set, validates the matching Media Library attachments and updates the product only when the complete image assignment can be applied safely.

Continuous Catalogue Audit

 

The main operating mode is a continuous full-catalogue audit.

The audit:
1. Identifies all qualifying WooCommerce products
2. Processes them gradually through WooCommerce Action Scheduler
3. Compares each product with Stock2Shop
4. Updates genuine image differences
5. Records products that are already correct
6. Separates unresolved products for review
7. Applies verified duplicate cleanup where enabled
8. Starts a new audit after the configured cooling-off period

Only one audit run can be active at a time. An interrupted or paused audit retains its progress and resumes from the remaining products.

Audit History and Monitoring

The plugin maintains a permanent run history with the latest audit shown first.

Audit reporting includes:
• Products checked
• Images updated
• Products requiring no change
• Products requiring review
• Processing errors
• Duplicate filenames accepted
• Superseded attachments deleted
• Cleanup candidates retained
• Cleanup failures
• Estimated storage recovered
• Audit duration and progress

Operational monitoring can also identify:
• Stalled or overdue audits
• Action Scheduler availability problems
• Stock2Shop authentication failures
• Processing-error thresholds
• Duplicate-cleanup failures
• Queue inconsistencies
• Missing future audit cycles

Optional administrator email alerts and recovery notifications can be enabled.

User Permissions

WordPress Administrators

Administrators can:
• Configure Stock2Shop credentials
• Control the audit scope
• Select the audit pace
• Start, pause, resume or recover an audit
• Perform manual product synchronisation
• Configure duplicate handling and cleanup
• Review and export audit history
• Configure monitoring and alerts
• Run production-acceptance checks
• Access technical diagnostics

WooCommerce Shop Managers

Shop Managers may be granted limited operational access, including:
• Viewing audit progress
• Performing manual product synchronisation
• Reviewing audit results and history
• Starting, pausing or resuming an audit where permitted

Sensitive API credentials and advanced security settings remain restricted to administrators.

YBO Apps Integration

YBO S2S Image Sync appears beneath the shared WordPress administration menu:

YBO Apps → Image Sync

The shared YBO Apps Overview provides direct access to the application alongside other YBO-developed plugins.

Configuration Settings

Continuous Audit

The continuous audit can be enabled or disabled.

Once an audit completes, the next full audit begins after the configured cooling-off period. The recommended default is 24 hours.

Product Scope

Administrators can choose whether to include:
• Published products only
• Draft and private products
• In-stock products
• Products on backorder
• Out-of-stock products

Audit Pace

The plugin is designed to operate slowly and with minimal impact.
Available pace profiles include:
Gentle
• Approximately one product every 30 seconds
• Single concurrent worker
• Suitable for cautious operation and constrained hosting
Standard
• Approximately one product every 20 seconds
• Single concurrent worker
• Recommended for normal controlled operation
Faster
• Approximately one product every 15 seconds
• Single concurrent worker
• Suitable only where API and hosting stability have been confirmed
Custom
Advanced administrators can configure a custom product interval and concurrency limit.

For YBO-managed sites, conservative intervals of approximately 15–30 seconds are recommended to reduce:
• Stock2Shop API restrictions
• WordPress server load
• Database activity
• Action Scheduler bursts
• Cloudflare or hosting rate limiting

Duplicate Filename Handling

Administrators can select:
• Block duplicate matches and require review
• Use the newest attachment
• Use the oldest attachment

Duplicate Attachment Cleanup

Administrators can choose whether to:
• Retain superseded duplicate attachments
• Permanently delete verified superseded attachments and files
Permanent cleanup is performed only after the product update has been saved and verified.

Audit History Retention

Run summaries can be retained permanently while detailed product-level records are removed after a configurable retention period.

Monitoring and Alerts

Monitoring settings include:
• Stalled-audit threshold
• Processing-error threshold
• Duplicate-cleanup failure threshold
• Alert recipients
• Alert cooldown
• Recovery notifications
• Production-acceptance sample size

Stock2Shop Connection

The connection settings include:
• Stock2Shop username
• Password or server-defined credentials
• Source ID
• Secure API endpoint
• Connection test

Passwords and authentication tokens are not displayed in logs or returned through diagnostics.

Performance and Safety Considerations

YBO S2S Image Sync is designed to:
• Process large catalogues gradually
• Avoid overlapping audit runs
• Preserve progress during pauses or interruptions
• Apply product-level retries
• Respect configured API spacing
• Use WooCommerce Action Scheduler
• Prevent stale workers from changing a superseded run
• Verify image assignments before deleting duplicates
• Retain unresolved products for review
• Avoid rewriting products that are already correct
• Maintain a permanent audit trail
• Provide operational health monitoring

For catalogues containing thousands of products, a full audit may take many hours or several days. This is deliberate.

The plugin is intended to operate continuously and quietly in the background rather than completing the catalogue as quickly as possible.

Support

YBO S2S Image Sync is a custom-developed WooCommerce and Stock2Shop integration by YBO Digital.

Support requests:
support@ybo.digital

The plugin requires:
• WordPress
• WooCommerce
• A valid Stock2Shop account
• Stock2Shop API access
• Product images already synchronised into the WordPress Media Library

The plugin does not replace Stock2Shop. It provides the WooCommerce image reconciliation, duplicate handling, audit history and monitoring layer required after Stock2Shop has supplied the product-image data and files.