Skip to content

feat(woocommerce): add 17 trigger events and 34 Pro actions - #234

Open
RishadAlam wants to merge 30 commits into
mainfrom
feat/woocommerce-events
Open

RishadAlam wants to merge 30 commits into
mainfrom
feat/woocommerce-events

Conversation

@RishadAlam

@RishadAlam RishadAlam commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Description

Adds 17 WooCommerce trigger events and 34 WooCommerce write actions. This plugin lists the new events and their fields, and hands each new action to Bit Integrations Pro through its own bit_integrations_woocommerce_<module> filter. Bit Integrations Pro fires the events and runs the actions (companion PR: https://github.com/bit-apps-pro/bit-integrations-pro/pull/156).

Motivation & Context

Bit Flows already supports these WooCommerce events and actions, and Bit Integrations did not. Testing every event and action in a real store also turned up a few older WooCommerce trigger bugs, fixed here.

Related Links: (if applicable)

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • ⚡ Improvement
  • 🔄 Code refactor

Key Changes

Triggers

  • Added 17 Pro events (IDs 34 to 50): Order Paid, Order Note Added, Order Refunded (Full or Partial), Product Viewed, Product Out of Stock, Product Low Stock, Product Back in Stock, Variation Out of Stock, Variation Back in Stock, Review Approved, Review Status Changed, Review Rating Updated, Review Deleted, Coupon Created, Coupon Updated, Coupon Moved to Trash and Coupon Restored from Trash. Each event reuses the order, product, review or coupon fields and adds its own (note, refund, viewer, variation stock, review status, previous coupon status).
  • Added Product ID, Product Name, Variation ID, Quantity and Cart Total to Product Removed from Cart.
  • Fixed _low_stock_amount in the product triggers: it was hardcoded to 1. It now sends the threshold WooCommerce uses for the product.
  • Fixed the coupon Date Modified field, which was labelled "Website", and renamed "Refunded By" to "Refunded By User Id". Field keys do not change, so saved flows keep their mapping.

Actions

  • Added 34 Pro modules: Add Order Note, Add or Update Order Meta, Update/Delete Customer, Update Product, Update Product Stock, Update Product Status, Update Product Price, Delete Product, Create/Update Product Variation, Create/Update/Delete Category, Tag, Brand or Shipping Class, Create/Update/Delete Attribute, Add Attribute Terms, Add/Remove Attribute on a Product, Add/Remove Product in Cart, Apply/Remove Coupon in Cart, Send Abandoned Cart Email, Create/Update Coupon, Change Coupon Code, Add Allowed Emails to Coupon, Delete Coupon, Create/Update/Approve/Delete Product Review.
  • Added RecordApiHelper::executeModuleAction: a WooCommerce-active check, a required-field check against the field definitions saved with the flow, the selected options merged into the field data, one filter per module in a switch, and a log entry for every path. The five original modules keep their own path.
  • Added the wc_refresh_options route for the option lists: products, categories, tags, brands and shipping classes. Products load through a light get_posts query (no meta or term cache), which also lists product types that other plugins add, such as subscriptions.

Frontend

  • Changed the module field to a grouped MultiSelect built from one moduleGroups list (the 5 original and 34 Pro modules), labelled with checkIsPro / getProLabel like QuizMaker. Without Pro, the Pro modules show "(Pro)" and are disabled. Saved flows keep their module values.
  • Added the static data of the Pro modules to staticData.js, like QuizMaker: moduleFields (each field map), the option selects and the utilities. The field map is built in the browser, so these modules need no field request.
  • Refactored WooCommerceModuleOptions to hold the options of every module (the Change Order Status filter and order change selects and the Cancel Subscription product select moved in unchanged), and WooCommerceActions to hold the utility checkboxes. The change-status lists and the field rows each choice creates moved to staticData.js.
  • Fixed saved store-list options (for example categories or upsells) showing as empty on the edit screen. MultiSelect only reads its labels when its value changes, so it now mounts again once its list loads, and shows "Loading..." until then.
  • Fixed WooCommerce and EditWooCommerce not passing setSnackbar to the layout, so the refresh buttons threw.
  • Improved Next validation for the Pro modules: it names the row to fix ("Map a value for Amount", including an empty custom value) and the missing required option ("Discount Type is required").

Testing

  • Built every module as a real flow in the UI (Chrome) on a local WooCommerce 11.1 site, fired each one, and checked the store data, the log and the emails (Mailpit).
  • Fired every trigger by doing the store action by hand: coupon create/edit/trash/restore, review approve/unapprove/rating/delete, product stock and variation stock edits, product status and restore, an order note, a partial refund, guest checkouts for Low Stock and Order Paid, and cart removal.
  • Also checked the edit screen, the free (non-Pro) view and the Next validation.
  • WP-CLI harnesses in rolled-back transactions: 24 trigger checks and 64 action checks pass.
  • After the refactor: the old Create-Product and Create-Order flows open unchanged, Change Order Status and Cancel Subscription behave as before, and a new flow ran end to end.
  • eslint --max-warnings=0, Prettier, php-cs-fixer and PHPCompatibilityWP (7.4) are clean on the changed files.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Tests added/updated
  • Documentation updated if needed
  • README updated if needed

Changelog

  • New Triggers

  • WooCommerce: 17 new events added (Pro).

  • New Actions

  • WooCommerce: 34 new events added (Pro).

  • Improvements

  • WooCommerce: Product Removed from Cart now includes the removed product's ID, name, variation, quantity and the cart total (Pro).

  • Bug Fixes

  • WooCommerce: Product Status Changed and Restore Product never ran, and Product Removed from Cart ran the Product Added to Cart flows (Pro).

  • WooCommerce: The Low Stock Amount field always sent 1. It now sends the product's low stock threshold.

  • WooCommerce: The coupon Date Modified field was labelled "Website".

🤖 Generated with Claude Code

Add the Pro events Order Paid, Order Note Added, Order Refunded, Product
Viewed, Product Out of Stock, Product Low Stock, Product Back in Stock,
Variation Out of Stock, Variation Back in Stock, Review Approved, Review
Status Changed, Review Rating Updated, Review Deleted, Coupon Created,
Coupon Updated, Coupon Moved to Trash and Coupon Restored from Trash
(IDs 34 to 50). Bit Integrations Pro fires them.

The field list for each event reuses the order, product, review and
coupon fields, and adds the note, refund, viewer, variation stock, review
status and previous coupon status fields the events send.
…grations Pro

Add 34 Pro modules to the WooCommerce action: order notes and meta,
update and delete customer, update product, stock, status and price,
delete product, product variations, category/tag/brand/shipping class
terms, attributes and attribute terms, cart actions, the abandoned cart
email, coupons and product reviews.

WooCommerceActionModules defines the field map of each module, and
wc_refresh_fields returns it. RecordApiHelper checks the required fields,
merges the selected options into the field data, fires one
bit_integrations_woocommerce_<module> filter per module and logs the
response. The existing modules keep their own path.
The new wc_refresh_options route returns products and product
categories, tags, brands or shipping classes as value/label pairs for
the option dropdowns. A taxonomy that is not registered, such as
product_brand before WooCommerce 9.6, returns an empty list.
WooCommerce and EditWooCommerce never passed setSnackbar to
WooCommerceIntegLayout, so the field and subscription product refresh
buttons threw when they tried to show their message.
The module select lists the 34 Pro modules in groups, disabled with a
(Pro) label when Bit Integrations Pro is not active.

Each module can show option selects above the field map, for fixed
choices such as status or discount type and for store lists that load
on demand with a refresh button, and utility checkboxes below it. The
values are saved as selects and utilities and reset when the module
changes. Next checks that required options are chosen.
A required field without a value logged "note is required for
woocommerce add_order_note". The error now uses the field label, for
example "Note is required".
…eld map

Required rows were added one by one to the top of the field map, so
they showed in reverse order, Amount before Coupon Code. They are now
added together in their defined order. The + button is hidden when a
module has no optional field left to add, since the new row could not
be filled. Also drop an explanatory comment from staticData.js.
The Date Modified field of the coupon events was labelled Website, and
Refunded By sends a user ID, so it is now labelled Refunded By User Id
like Viewer User Id. The field keys do not change, so saved flows keep
their mapping.
The product payload set _low_stock_amount to 1 for every product. It
now sends the threshold WooCommerce uses for the product: its own value,
then the parent product, then the store setting. Product Low Stock is
the event that needs it most.
Add Product ID, Product Name, Variation ID, Quantity and Cart Total to
the fields of Product Removed from Cart, the same details Product Added
to Cart sends. Bit Integrations Pro sends the values.
The product option lists loaded every product as a full WC_Product with
all its meta. A light get_posts query with the meta and term caches off
returns the IDs and titles the dropdown needs, and it also lists
products of types other plugins add, such as subscriptions.
MultiSelect reads its selected labels only when its value changes, so a
saved category, tag or product looked empty when its list loaded after
the select mounted, and picking a new value dropped the saved ones. The
select now mounts again once its list is loaded and shows Loading...
until then.
The Pro modules carry is_pro: true and the module select uses
checkIsPro, the same check FluentCart and the other integrations use.
For the Pro modules, Next now says which row is incomplete, for example
"Map a value for Amount", instead of "Field Map can't be empty". It also
catches a custom value left empty.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 06:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

The field map of each Pro module now lives in staticData.js as
moduleFields, like QuizMaker and FluentCart. Choosing a module builds its
field map in the browser instead of calling wc_refresh_fields, so
WooCommerceActionModules.php is removed and the Refresh fields button is
hidden for these modules.

RecordApiHelper hands every module except the five original ones to Bit
Integrations Pro and checks required fields against the field
definitions saved with the flow. The original modules keep their own
path, and generateMappedFields is back to its main version.
The five original modules and the 34 Pro modules now come from one
moduleGroups list in staticData.js. The module field is a MultiSelect
grouped by Order, Customer, Product and the rest, labelled with checkIsPro
and getProLabel like the other integrations. Saved flows keep their
module values.
WooCommerceActions.jsx renders the utility checkboxes, the name the
other integrations use, and the layout shows the Utilities heading only
when the module has utilities.
…ptions

WooCommerceModuleOptions now holds the options of all modules: the
Change Order Status filter and order change selects and the Cancel
Subscription product select, moved from the layout unchanged, next to the
Pro module option selects. The filter and order change lists, and the
field rows each choice creates, move to staticData.js.
…ons run

RecordApiHelper returns and logs an error when WooCommerce is not
active, before it hands an action to Bit Integrations Pro, so Pro no
longer repeats the check in each action.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Build MultiSelect options from a list of { name, label, is_pro, group }
items. Pro items get the (Pro) label and are disabled when Bit
Integrations Pro is not active. Items with a group are grouped in the
order the groups first appear, and items without one stay plain options.
Without Pro, the free options and the groups that hold them come first.

Integrations can use it instead of mapping checkIsPro and getProLabel
themselves.
The modules list is a flat list again, with a group on each module, and
the layout passes it to getProSelectOptions instead of building the
grouped options itself. Without Pro, the free modules are listed first.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 07:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The helper builds the options of a whole module list, free and Pro, so
it is named after the modules lists it takes.
The WooCommerce action settings step gets a minimum height of 500px,
so the module list has room to open below the Module field.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 07:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The field map listed form fields without a group and no General Smart
Codes, so WordPress values such as the current user could not be mapped.
The module field maps are nested per module, which Flow does not scan,
so the controller now resolves smart code values itself.
The 500px minimum height applied on every step, so the hidden settings
step stayed on screen as a squeezed column beside the final step.
The custom value check negated formField before comparing it, so it was
always false and an empty Custom row passed validation.
The required check read the form value under the formField key, which is
'custom' for custom values, so a mapped custom SKU failed with
"_sku is required". Customer rows used the raw custom value without
replacing field placeholders.
The execution log showed only the new ID, such as 10.
Copilot AI balanced review requested due to automatic review settings November 5, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants