Hooks: mam_wc_vendor_get_tip_product and mam_wc_vendor_split_tip

mam_wc_vendor_get_tip_product

$tip_product_id = apply_filters( 'mam_wc_vendor_get_tip_product', int $vendor_id );
Parameter Type Description
$vendor_id int Vendor term id (the input value)

Returns the product id of that vendor’s hidden “Tip” product.

Note the deliberate in/out overload: the value going in is a vendor id; the value coming out of the registered handler is a product id. The handler (priority 10) resolves the vendor’s cached tips_product_id term meta, recovers by deterministic SKU (mg-<vendor>-fee-tip) if the cache is stale, and otherwise creates a hidden simple product assigned to the vendor — so tip line items always commission to the right vendor. Companion filters with identical semantics exist for mam_wc_vendor_get_shipping_product (“Delivery Fees”) and mam_wc_vendor_get_driver_tip_product (“Driver Tip”).

When it fires: the order-review tip flow, checkout tip handling, and sibling plugins (e.g. mam-woocommerce-ride-share resolves a driver-vendor’s tip product) whenever a tip needs a product to attach to.

// Get (or lazily create) the Tip product for a vendor:
$tip_product_id = (int) apply_filters( 'mam_wc_vendor_get_tip_product', $vendor_id );

mam_wc_vendor_split_tip

$tip_amount = apply_filters( 'mam_wc_vendor_split_tip', float|string $tip_amount, WC_Order $order, int $vendor_id );
Parameter Type Description
$tip_amount float|string The tip amount about to be credited to $vendor_id
$order WC_Order The order the tip belongs to
$vendor_id int The vendor receiving the (remaining) tip

Returns the adjusted tip amount for that vendor.

When it fires:

  • in the review/tips flow, after a tip charge succeeds and before the tip is attached to the vendor’s Tip product (gated by mam_wc_vendor_is_split_tip, default true);
  • in checkout tip handling (mam_wc_vendor_add_tips_product), before the tip is split evenly across the order’s vendors.

This plugin registers no default callback — unfiltered, the vendor keeps the whole tip. It is the extension point sibling plugins use to divert a share: mam-woocommerce-delivery and mam-woocommerce-ride-share both hook it (10, 3 args) to carve out the driver’s portion of the tip on delivered orders.

add_filter( 'mam_wc_vendor_split_tip', function ( $tip_amount, WC_Order $order, $vendor_id ) {
    if ( $order->get_meta( 'assigned_to_driver' ) ) {
        return round( (float) $tip_amount / 2, 2 ); // vendor keeps half, driver flow takes the rest
    }
    return $tip_amount;
}, 10, 3 );

Notes

  • Whether the review tip becomes a separate tip order or a line on the original order is controlled by the mam_wc_vendor_review_tip_as_separate_order filter (default true) and the Vendor Tips have Separate Products setting.
  • Return a numeric value from mam_wc_vendor_split_tip; it feeds directly into order item subtotals.
  • If you reduce the vendor’s share, your plugin is responsible for crediting the remainder (e.g. by adding the driver-tip product) — the split filter only changes the vendor side.


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 filter (both)
Audience PHP developer / integrator
Last verified 2026-06-10
Was this article helpful?
Contents

    Need Support?

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