Skip to content

New: Log staff changes to WooCommerce product price, SKU and stock - #314

Merged
KingYes merged 3 commits into
masterfrom
new/woocommerce-products
Nov 18, 2026
Merged

KingYes merged 3 commits into
masterfrom
new/woocommerce-products

Conversation

@KingYes

@KingYes KingYes commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Adds WooCommerce product and variation logging to AAL_Hook_WooCommerce for staff users with edit_products, using woocommerce_before_product_object_save to build a whitelisted diff and woocommerce_update_product / woocommerce_update_product_variation to write one updated row with AAL_Changes meta.

Order-driven stock adjustments are ignored while the woocommerce_*_before_set_stock / woocommerce_*_set_stock window is active so fulfillment does not create product audit noise.

Known limitation: Bulk Edit stock quantity changes are not captured. Shop Manager visibility rules are unchanged from existing WooCommerce order logging.

Open in Web Open in Cursor 

✨ PR Description

1. Problem & Context

Adds audit logging for manual staff modifications to WooCommerce product attributes (price, SKU, stock) to track administrative changes.

2. What Changed (Where)

  • hooks/class-aal-hook-woocommerce.php: Implements product change detection and logging logic.
  • i18n/strings.php: Adds translation strings for product and variation subtypes.
  • tests/phpunit/test-hook-woocommerce.php: Adds product stubs and comprehensive test suite for logging logic.

3. How It Works

Intercepts woocommerce_before_product_object_save to calculate a diff of whitelisted fields; if changes exist, they are cached in $pending_product_changes and committed to the log during the final update hook. It explicitly suppresses logs during order-driven stock updates via a boolean flag to avoid noise.

4. Risks

Potential memory overhead if a large number of products are updated in a single request due to the $pending_product_changes array.

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

Co-authored-by: Yakir Sitbon <KingYes@users.noreply.github.com>
KingYes and others added 2 commits November 13, 2026 09:55
Co-authored-by: Yakir Sitbon <KingYes@users.noreply.github.com>
Co-authored-by: Yakir Sitbon <KingYes@users.noreply.github.com>
@KingYes
KingYes merged commit fc38479 into master Nov 18, 2026
51 checks passed
@KingYes
KingYes deleted the new/woocommerce-products branch November 18, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant