Signature
do_action( 'mam_submit_order' );
No arguments. The handler reads everything from the request:
| Input | Where | Description |
|---|---|---|
| Cart payload | raw request body (php://input) |
JSON with an orderDetails array; the first element is the cart (items, addresses, tips, taxes, fees, totals). |
coupon |
$_REQUEST['coupon'] |
Optional coupon code echoed onto the order. |
| Acting customer | mam_user_id() |
Resolved server-side by MAM Main from the app session — never from request parameters. |
When it fires
mam-woocommerce registers the handler on this hook; anything that fires the action triggers a complete order submission. There are two ways an order submission starts:
- The primary app path — the app posts to
admin-ajax.php?action=mam_woocommerce_managerwith subactionmam_submit_orderand the user’s app token (pid). This path calls the same pipeline directly (it does not fire the hook). - The hook path — server-side code (another plugin, or an older dispatch flow) runs
do_action( 'mam_submit_order' )during a request that carries the cart payload.
Warning — this handler terminates the request. It ends with
wp_send_json()+die(), returning a JSON payload (status,order_id,message, plus refreshed app data injsonData). Only fire it when JSON-and-exit is the desired outcome.
The legacy alias tsl_submit_order (and the duplicate filter registrations of both names) exists only for app builds in the wild and is scheduled for removal on Dec 1, 2026 — use the action mam_submit_order.
What the pipeline does
- Authorizes: the order is created for the server-resolved user only; with no resolved user the submission is denied (escape hatch:
mam_wc_user_can_submit_order). - Validates the cart payload and lets pre-processors veto or take over (
woocommerce_before_order_modify_cart,mam_woocommerce_menu_before_order_processing). - Creates the
WC_Orderwith items, addresses, tips, taxes, and fees, then charges viamam_pmt_charge_card(or places a hold — see Configure checkout for the app). - Filters the result through
mam_wc_order_completedand responds.
Example — trigger a submission from a custom dispatcher
// Inside an authenticated request that carries the order JSON body:
if ( has_action( 'mam_submit_order' ) ) {
do_action( 'mam_submit_order' ); // responds with JSON and exits
}
Related articles
- Plugin: mam-woocommerce
- Hook:
mam_wc_order_completed - Hook:
mam_pmt_charge_card/mam_pmt_refund_card - Hook: the `mam_wc_usercan` authorization filters*
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-woocommerce |
| Applies to plugin version | 26.19.3+ |
| Category | Extending MAM Suite |
| Hook type | action (a filter registration also exists for back-compat) |
| Audience | PHP developer |
| Last verified | 2026-06-10 |
