Hook: mam_wc_order_completed

Signature

$data_array = apply_filters( 'mam_wc_order_completed', array $data_array );
Parameter Type Description
$data_array array The submission result so far. On success: status ('success'), order_id (the new WooCommerce order id), and possibly message (e.g. a charge error). Return it (modified or not).

When it fires

At the end of every app order submission — both the mam_woocommerce_manager AJAX path and the mam_submit_order hook path — after the order has been created and the charge attempted, and before the refreshed app data (jsonData) is attached and the JSON response is sent.

It also fires on the AJAX endpoint’s fallback branch (unrecognized subaction), where $data_array only carries the failure status — check for order_id before treating a call as a completed order.

Note: despite the name, this fires when the submission pipeline completes, not when the order reaches the WooCommerce Completed status.


Example — react to a new app order

add_filter( 'mam_wc_order_completed', function ( array $data_array ) {

    if ( ! empty( $data_array['order_id'] ) && ( $data_array['status'] ?? '' ) === 'success' ) {
        // e.g. push the order to a kitchen display system
        my_kds_push( (int) $data_array['order_id'] );

        // add a key the app can read from the response
        $data_array['kds_ticket'] = 'queued';
    }

    return $data_array;
} );

Notes

  • Always return the array — returning nothing breaks the response.
  • The order is already saved and charged when this fires; it is a notify/augment point, not a veto. To veto an order before it is created, use mam_woocommerce_menu_before_order_processing (return an array with status => 'failed' and a message).


Metadata

Field Value
Article type Hook Reference
Plugin slug mam-woocommerce
Applies to plugin version 26.19.3+
Category Extending MAM Suite
Hook type filter
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!