Hook: mam_wc_settle_order

Signature

$result = apply_filters( 'mam_wc_settle_order', array(), int $order_id, int $user_id );
Parameter Type Description
(first arg) array Pass an empty array; it is returned unchanged if no handler is registered (i.e. mam-woocommerce inactive).
$order_id int The WooCommerce order to settle.
$user_id int The order’s customer (used for the payment-plugin charge args).

Returns the payment plugin’s result array — typically status (truthy on success) and charge (the gateway charge/intent object) — or an empty array when there was nothing to settle.


What it does

mam-woocommerce answers this filter with its settle handler:

  1. Stamps order_last_updated on the order.
  2. Looks at the order’s stored Stripe charges (_stripe_charge_ids meta):
    • last charge is an open hold (requires_capture) → captures it for the order’s current total via mam_pmt_charge_card (capture = yes, last_charge_id set);
    • last charge already settled → returns it as an immediate success (idempotent — safe to call twice);
    • no stored charge → makes a fresh mam_pmt_charge_card charge for the order total.

This is the second half of the hold-and-settle flow: checkout places a 120% authorization hold, and this hook captures the exact final amount later (after tips or order edits).


Who calls it

  • MAM WooCommerce Product Vendors — its auto-settle cron settles eligible orders once # Days after Order Complete to Settle the Order have passed, and its commission manager settles before paying out a vendor.
  • Your code — to settle on your own trigger (e.g. when a driver marks delivery complete).

Example — settle when an order is marked completed

add_action( 'woocommerce_order_status_completed', function ( $order_id ) {

    if ( ! has_filter( 'mam_wc_settle_order' ) ) {
        return; // mam-woocommerce not active
    }

    $order  = wc_get_order( $order_id );
    $result = apply_filters( 'mam_wc_settle_order', array(), $order_id, $order->get_user_id() );

    if ( empty( $result['status'] ) ) {
        // capture failed — alert staff
    }
} );

Notes

  • Introduced in 26.19.3 to replace direct cross-plugin class calls — always reach settling through this hook, never by instantiating mam-woocommerce classes.
  • The settle path assumes Stripe-stored charge meta; other gateways settle via their own flows.


Metadata

Field Value
Article type Hook Reference
Plugin slug mam-woocommerce
Applies to plugin version 26.19.3+ (introduced in this version)
Category Extending MAM Suite
Hook type filter (mam-woocommerce registers the handler; you call apply_filters)
Audience PHP developer
Last verified 2026-06-10
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!