Skip to main content

Commerce Hooks

Use these hooks to adjust WooCommerce-linked course/group sales behavior, B2B cohort purchase rules, invoices, offline payments, and related commerce UI.

Only custom MentorKit hooks from docs-lms/hook-metadata.json are documented here. Classic WordPress, WooCommerce, Polylang, Astra, and other external hooks are intentionally excluded.

Documented hooks: 15.

Documented Hooks

HookTypeStatus
scorm_b2b_cohort_refundedActionPublic
scorm_b2b_cohort_topped_upActionPublic
scorm_b2b_expiry_warning_sentActionPublic
scorm_b2b_max_seats_sliderFilterPublic
scorm_b2b_min_qtyFilterPublic
scorm_b2b_subgroup_createdActionPublic
scorm_b2b_topup_on_repurchaseFilterPublic
scorm_b2b_validity_daysFilterPublic
scorm_course_default_tax_classFilterPublic
scorm_group_default_tax_classFilterPublic
scorm_invoice_due_date_tsFilterPublic
scorm_invoice_kidFilterPublic
scorm_leader_dashboard_after_titleActionPublic
scorm_my_orders_statusesFilterPublic
scorm_offline_payment_methodsFilterPublic

scorm_b2b_cohort_refunded

Type: Action Category: Commerce Source: includes/woocommerce/b2b-lifecycle.php:81 Status: Public

When It Runs

Fires when B2B cohort refunded. The source call is inside scorm_b2b_handle_refund(). Source context: When a WC order containing a B2B cohort is refunded, set the cohort's valid_until to today (effectively expiring it) and e-mail the buyer.

Parameters

Callback parameterSource valueNotes
$cohort_id$cohort_idAdditional context passed by the hook.
$order$orderAdditional context passed by the hook.
$was_topup$was_topupAdditional context passed by the hook.

Example

add_action(
'scorm_b2b_cohort_refunded',
function ( $cohort_id, $order, $was_topup ) {
// Add your integration logic here.
},
10,
3
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_b2b_cohort_topped_up

Type: Action Category: Commerce Source: includes/woocommerce/b2b-auto-subgroup.php:393 Status: Public

When It Runs

Fires for B2B cohort topped up. The source call is inside scorm_b2b_create_subgroup_from_line(). Source context: Create a sub-group for one WC order line. Idempotent: if the order item already has _scorm_subgroup_id, returns that ID without creating a new post.

Parameters

Callback parameterSource valueNotes
$topup_target$topup_targetAdditional context passed by the hook.
$master_id$master_idAdditional context passed by the hook.
$order$orderAdditional context passed by the hook.
$buyer_id$buyer_idAdditional context passed by the hook.
$qty$qtyAdditional context passed by the hook.

Example

add_action(
'scorm_b2b_cohort_topped_up',
function ( $topup_target, $master_id, $order, $buyer_id, $qty ) {
// Add your integration logic here.
},
10,
5
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_b2b_expiry_warning_sent

Type: Action Category: Commerce Source: includes/woocommerce/b2b-lifecycle.php:205 Status: Public

When It Runs

Fires when B2B expiry warning sent. The source call is inside scorm_b2b_send_expiry_warning(). Source context: Send a single expiry warning to the buyer.

Parameters

Callback parameterSource valueNotes
$cohort_id$cohort_idAdditional context passed by the hook.
$days$daysAdditional context passed by the hook.

Example

add_action(
'scorm_b2b_expiry_warning_sent',
function ( $cohort_id, $days ) {
// Add your integration logic here.
},
10,
2
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_b2b_max_seats_slider

Type: Filter Category: Commerce Source: templates/single-scorm_group.php:210 Status: Public

When It Runs

Filters B2B max seats slider. The source call is inside templates/single-scorm_group.php.

Parameters

Callback parameterSource valueNotes
$max_seats50Value passed through the filter. Source default: 50.
$scorm_group_id$scorm_group_idAdditional context passed by the hook.

Return Value

Return the filtered $max_seats value. Source default: 50. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_b2b_max_seats_slider',
function ( $max_seats, $scorm_group_id ) {
return $max_seats;
},
10,
2
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_b2b_min_qty

Type: Filter Category: Commerce Source: includes/frontend/group-helpers.php:388, includes/woocommerce/b2b-auto-subgroup.php:323 Status: Public

When It Runs

Filters B2B min qty. The source call is inside scorm_player_group_get_cta(). Source context: Compute the context-aware primary call-to-action for the group hero. This hook appears in 2 source locations.

Parameters

This hook is called from multiple source locations with different source signatures.

SourceCallback parameters
includes/frontend/group-helpers.php:388$minimum_quantity from 2
$wc_id from $wc_id
includes/woocommerce/b2b-auto-subgroup.php:323$minimum_quantity from 2
$product_id from $product_id

Return Value

Return the filtered $minimum_quantity value. Source default: 2. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_b2b_min_qty',
function ( $minimum_quantity, $wc_id ) {
return $minimum_quantity;
},
10,
2
);

Notes

  • Because the source signatures differ, write callbacks defensively when attaching the same callback across all contexts.
  • Parameter names vary between call sites.

scorm_b2b_subgroup_created

Type: Action Category: Commerce Source: includes/woocommerce/b2b-auto-subgroup.php:499 Status: Public

When It Runs

Fires when B2B subgroup created. The source call is inside scorm_b2b_create_subgroup_from_line(). Source context: Create a sub-group for one WC order line. Idempotent: if the order item already has _scorm_subgroup_id, returns that ID without creating a new post.

Parameters

Callback parameterSource valueNotes
$subgroup_id$subgroup_idAdditional context passed by the hook.
$master_id$master_idAdditional context passed by the hook.
$order$orderAdditional context passed by the hook.
$buyer_id$buyer_idAdditional context passed by the hook.
$qty$qtyAdditional context passed by the hook.

Example

add_action(
'scorm_b2b_subgroup_created',
function ( $subgroup_id, $master_id, $order, $buyer_id, $qty ) {
// Add your integration logic here.
},
10,
5
);

Notes

  • MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.

scorm_b2b_topup_on_repurchase

Type: Filter Category: Commerce Source: includes/woocommerce/b2b-auto-subgroup.php:376 Status: Public

When It Runs

Filters B2B top-up on repurchase. The source call is inside scorm_b2b_create_subgroup_from_line(). Source context: Create a sub-group for one WC order line. Idempotent: if the order item already has _scorm_subgroup_id, returns that ID without creating a new post.

Parameters

Callback parameterSource valueNotes
$topup_on_repurchasetrueValue passed through the filter. Source default: true.
$master_id$master_idAdditional context passed by the hook.
$buyer_id$buyer_idAdditional context passed by the hook.
$order$orderAdditional context passed by the hook.

Return Value

Return the filtered $topup_on_repurchase value. Source default: true. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_b2b_topup_on_repurchase',
function ( $topup_on_repurchase, $master_id, $buyer_id, $order ) {
return $topup_on_repurchase;
},
10,
4
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_b2b_validity_days

Type: Filter Category: Commerce Source: includes/woocommerce/b2b-auto-subgroup.php:458 Status: Public

When It Runs

Filters B2B validity days. The source call is inside scorm_b2b_create_subgroup_from_line(). Source context: Create a sub-group for one WC order line. Idempotent: if the order item already has _scorm_subgroup_id, returns that ID without creating a new post.

Parameters

Callback parameterSource valueNotes
$validity_days$validity_daysValue passed through the filter. Source default: $validity_days.
$master_id$master_idAdditional context passed by the hook.
$subgroup_id$subgroup_idAdditional context passed by the hook.
$order$orderAdditional context passed by the hook.

Return Value

Return the filtered $validity_days value. Source default: $validity_days. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_b2b_validity_days',
function ( $validity_days, $master_id, $subgroup_id, $order ) {
return $validity_days;
},
10,
4
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_course_default_tax_class

Type: Filter Category: Commerce Source: includes/woocommerce/woocommerce-meta-fields.php:63, includes/woocommerce/woocommerce-meta-fields.php:1275 Status: Public

When It Runs

Filters course default tax class. The source call is inside scorm_player_woocommerce_meta_box_callback(). Source context: WooCommerce settings meta box callback. This hook appears in 2 source locations.

Parameters

Callback parameterSource valueNotes
$tax_class''Value passed through the filter. Source default: ''.

Return Value

Return the filtered $tax_class value. Source default: ''. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_course_default_tax_class',
function ( $tax_class ) {
return $tax_class;
},
10,
1
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_group_default_tax_class

Type: Filter Category: Commerce Source: includes/admin/meta-fields-group.php:1880, includes/admin/meta-fields-group.php:2556 Status: Public

When It Runs

Filters group default tax class. The source call is inside scorm_player_group_woocommerce_meta_box_callback(). Source context: WooCommerce settings meta box callback for groups. This hook appears in 2 source locations.

Parameters

Callback parameterSource valueNotes
$tax_class''Value passed through the filter. Source default: ''.

Return Value

Return the filtered $tax_class value. Source default: ''. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_group_default_tax_class',
function ( $tax_class ) {
return $tax_class;
},
10,
1
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_invoice_due_date_ts

Type: Filter Category: Commerce Source: includes/frontend/order-invoice.php:178 Status: Public

When It Runs

Filters invoice due date ts. The source call is inside SCORM_Order_Invoice::build_due_date().

Parameters

Callback parameterSource valueNotes
$due$dueValue passed through the filter. Source default: $due.
$created_ts$created_tsAdditional context passed by the hook.

Return Value

Return the filtered $due value. Source default: $due. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_invoice_due_date_ts',
function ( $due, $created_ts ) {
return $due;
},
10,
2
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_invoice_kid

Type: Filter Category: Commerce Source: includes/frontend/order-invoice.php:173 Status: Public

When It Runs

Filters invoice kid. The source call is inside SCORM_Order_Invoice::build_kid().

Parameters

Callback parameterSource valueNotes
$kid$kidValue passed through the filter. Source default: $kid.
$order$orderAdditional context passed by the hook.

Return Value

Return the filtered $kid value. Source default: $kid. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_invoice_kid',
function ( $kid, $order ) {
return $kid;
},
10,
2
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_leader_dashboard_after_title

Type: Action Category: Commerce Source: includes/frontend/group-leader-dashboard-shortcode.php:467 Status: Public

When It Runs

Fires after leader dashboard title. The source call is inside SCORM_Group_Leader_Dashboard_Shortcode::render_group_detail().

Parameters

Callback parameterSource valueNotes
$group_id$group_idAdditional context passed by the hook.

Example

add_action(
'scorm_leader_dashboard_after_title',
function ( $group_id ) {
// Add your integration logic here.
},
10,
1
);

Notes

  • MentorKit also registers internal callbacks for this hook. Keep custom callbacks narrowly scoped.

scorm_my_orders_statuses

Type: Filter Category: Commerce Source: includes/frontend/my-orders-section.php:41 Status: Public

When It Runs

Filters my orders statuses. The source call is inside SCORM_My_Orders_Section::get_user_orders().

Parameters

Callback parameterSource valueNotes
$statusesself::STATUSESValue passed through the filter. Source default: self::STATUSES.

Return Value

Return the filtered $statuses value. Source default: self::STATUSES. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_my_orders_statuses',
function ( $statuses ) {
return $statuses;
},
10,
1
);

Notes

  • Keep callbacks small and scoped to the source context shown above.

scorm_offline_payment_methods

Type: Filter Category: Commerce Source: includes/frontend/order-invoice.php:152, includes/woocommerce/woocommerce-integration.php:687 Status: Public

When It Runs

Filters offline payment methods. The source call is inside SCORM_Order_Invoice::is_offline_method(). This hook appears in 2 source locations.

Parameters

This hook is called from multiple source locations with different source signatures.

SourceCallback parameters
includes/frontend/order-invoice.php:152$methods from self::DEFAULT_OFFLINE_METHODS
includes/woocommerce/woocommerce-integration.php:687$methods from array('bacs', 'cheque', 'cod')

Return Value

Return the filtered $methods value. Source default: self::DEFAULT_OFFLINE_METHODS. If you do not need to change it, return the original value unchanged.

Example

add_filter(
'scorm_offline_payment_methods',
function ( $methods ) {
return $methods;
},
10,
1
);

Notes

  • Because the source signatures differ, write callbacks defensively when attaching the same callback across all contexts.
  • Multiple default value expressions were found across filter call sites.