Signature
do_action( 'mam_wcpv_vendor_commission_payout', int $order_id, bool $force_payout = false );
| Parameter | Type | Description |
|---|---|---|
$order_id |
int |
The WooCommerce order whose vendor commissions should be paid |
$force_payout |
bool |
true bypasses the hold/settle-days eligibility wait (use only after the charge is captured) |
What the registered handler does
This plugin attaches pay_vendor_commission_payout (priority 10, accepts 2 args). In order:
- Idempotency — returns immediately if the order already has
_mam_vendor_paidmeta. - Eligibility (skipped when
$force_payoutistrue) — withtsl-setting-checkout_place_hold_on_order=yes, the order must becompletedandtsl-setting-checkout_settle_order_daysdays must have elapsed since completion. - Loads unpaid PV commissions for the order, grouped per vendor.
- Takes a per-order lock (
mam_wc_pv_payout_lock_<order id>option) so a concurrent cron + manual settle cannot double-transfer; stale locks expire after 10 minutes. - Routes by
mam_wc_pv_payout_method:stripe_connect— onemam_stripe_connect_transferfilter call per vendor (order_id,vendor_id,amount), handled by mam-stripe-manager;paypal— WooCommerce Product Vendors’ PayPal MassPay;- anything else — logged, no payout.
- On success, marks the commissions paid in PV and writes
_mam_vendor_paidon the order.
Who fires it
- The auto-settle cron after a successful capture (
$force_payout = true). - The manual settle AJAX endpoint after capture (
true). - The review/tips flow after a successful tip charge, for the original order and any separate tip order (
true).
Example — pay out an order from your own integration
// After your code has captured payment for $order_id:
do_action( 'mam_wcpv_vendor_commission_payout', $order_id, true );
Example — react to settled orders
The action itself is the trigger, so hook it at a later priority to observe:
add_action( 'mam_wcpv_vendor_commission_payout', function ( $order_id, $force = false ) {
$order = wc_get_order( $order_id );
if ( $order && $order->get_meta( '_mam_vendor_paid' ) ) {
// payout completed — notify, log, sync to accounting, …
}
}, 20, 2 );
Notes
- Money moves when this fires (if a payout method is configured). Never expose it to unauthenticated or unauthorized input; the in-plugin callers all authorize first.
- Safe to fire repeatedly for the same order — the paid flag and the lock make it idempotent.
- With
$force_payout = falsethe call is a no-op until the order is eligible, which is how the cron retries orders inside the settle window.
Related articles
- Recipe: Commissions, settlement, and payouts
- Hooks:
mam_wc_vendor_get_tip_productandmam_wc_vendor_split_tip
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-woocommerce-product-vendors |
| Applies to plugin version | 26.19.1+ |
| Category | Extending MAM Suite |
| Hook type | action |
| Audience | PHP developer / integrator |
| Last verified | 2026-06-10 |
