WP Manifestindependent plugin directory
manifest / ecommerce / insight-bulk-sale

Insight Bulk Sale Manager

Batched storewide sale prices for Careshop WooCommerce, with backup and rollback

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/udiinsight/insight-bulk-sale/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Applies a percentage sale price across the whole WooCommerce catalogue in batches, with a per-product backup and a batched rollback.

Built to replace the storewide Woo Discount Rules "כל החנות ללא מע\"מ" rule with real WooCommerce sale prices, so the price in the PixelYourSite product feed matches the price on the site.


What changed versus the original snippets

Original behaviour Now
Backup in one autoloaded bulk_sale_backup option, rewritten every batch One _cbs_backup post meta row per product; nothing autoloaded, writes stay flat
Second run overwrote the backup with the first run's promo price Backups are written once and never overwritten; a live run is blocked while a backup exists
Rollback ran in a single request Rollback is batched over AJAX, same as the apply step
OFFSET paging over a set being mutated Keyset paging (WHERE ID > cursor), immune to the set changing underneath
Cursor in the browser — a dropped request lost the position Cursor on the server; the page offers Resume
round($price, 0) could produce 0 or a sale ≥ regular Guarded: rejects <= 0 and >= regular, uses wc_get_price_decimals()
Discount always from the regular price Choice of regular price or current effective price (the latter reproduces Woo Discount Rules)
Count query and batch query selected different sets Progress measured against one stable denominator
A 0 in the exclude box excluded every simple product Numeric exclusions must be > 0
Backups auto-deleted after 60 days regardless of content Entries holding a real original sale price are never auto-deleted
No dry run Dry run reports exactly what would change, writes nothing
Variable parents left unsynced WC_Product_Variable::sync() per touched parent
No cache handling Flushes WC transients + WP Rocket, fires cbs/after_run_complete

Requirements

  • WordPress 6.4+, PHP 7.4+
  • WooCommerce 8.0+ (tested against 10.8)
  • Capability: manage_woocommerce

Install via WP Pusher

  1. The repo is udiinsight/insight-bulk-sale, with these files at the repo root (insight-bulk-sale.php is top-level, not nested in a folder).
  2. WordPress admin → WP Pusher → Install Plugin.
  3. Plugin repository: udiinsight/insight-bulk-sale, branch main (type it — a blank branch field defaults to master and fails), Repository subdirectory: leave empty.
  4. Install, then activate.
  5. Enable Push-to-Deploy if you want future commits to deploy automatically.

Screens appear under WooCommerce → 🛡️ מבצע המוני and WooCommerce → 🔍 בדיקת מבצע.

Test plan (staging first)

Always test on the site's staging copy first (hosting ids live in the local project notes, not in this repo).

  1. Install and activate on staging.
  2. Dry run at 15.25% — confirm the counts look sane and nothing changed in the DB.
  3. Exclude one known SKU, dry run again, confirm the excluded count moves by the right number.
  4. Real run on staging. Check a simple product, a variable product's range, and one variation.
  5. Roll back. Confirm prices return exactly, and that _cbs_backup rows are gone (SELECT COUNT(*) FROM wp_postmeta WHERE meta_key = '_cbs_backup' → 0).
  6. Re-run, then reload the page mid-run to confirm Resume picks up where it stopped.
  7. Only then repeat on production — and disable Woo Discount Rules rule 21 first, or every price is discounted twice.

Order of operations on production

  1. Disable Discount Rules rule ID 21 (כל החנות ללא מע"מ).
  2. Run this plugin at the same percentage, with no end date (an end date makes WooCommerce delete the sale price when it expires — and a pre-existing sale price will not come back on its own).
  3. Regenerate the PixelYourSite Product Catalog feed.
  4. Verify a few items in Meta Commerce Manager / Merchant Center against the live product pages.

To reverse the whole thing: roll back here, then re-enable rule 21.

Feed regeneration hook

The plugin does not assume anything about PixelYourSite's internals. Wire your own regeneration:

add_action( 'cbs/after_run_complete', function () {
    // Trigger the Product Catalog feed refresh here, e.g. by calling the
    // plugin's own cron hook or hitting the secured feeds_update endpoint.
} );

Notes

  • Strings are Hebrew literals rather than __() calls — the site is Hebrew-only and this keeps them editable in place. Wrap them in a text domain if that ever changes.
  • The admin CSS uses logical properties, so the layout mirrors without a separate RTL sheet.
  • Deleting the plugin does not delete backups. That is deliberate.