slicewp_get_commission_types()

Description

Returns all available types a commission can have.

Return

(array) An associative array containing the slugs, as keys, and data arrays, as values, of the type that a commission can have.

Examples

$commission_types = slicewp_get_commission_types();
// Returned value.

Array
(
    [sale] => Array
        (
            [label] => Sale
            [rate_types] => Array
                (
                    [0] => percentage
                    [1] => fixed_amount
                )

        )

    [subscription] => Array
        (
            [label] => Subscription
            [rate_types] => Array
                (
                    [0] => percentage
                    [1] => fixed_amount
                )

        )

    [recurring] => Array
        (
            [label] => Recurring
            [rate_types] => Array
                (
                    [0] => percentage
                    [1] => fixed_amount
                )

        )

)

The returned array can be filtered by applying a callback to the slicewp_register_commission_types filter.

More information

Each commission type has at least the label and rate_types elements.

The label is a string representing the name of the commission’s type and it’s used for output purposes.

The rate_types is an array representing the type of rates a commission’s amount can be calculated by. The rate types can be either percentage or fixed_amount.

For example, a commission of type sale will most probably be tied to an order from your eCommerce integration (let’s say WooCommerce). Because the amount of the commission can have both a fixed amount, not correlated with the order’s value, and also a percentage based amount, calculated from the order’s value, the sale commission type has both the percentage and fixed_amount rate types.

On the other hand, a commission of type user_signup is not tied to an order, which has a value, but rather to an action, in this case a user signing up for a service. Because of this, the rate type can only be fixed_amount.

Was this article helpful?

Do you have any feedback or suggestions to improve this page?

Can't find what you're looking for? We're here to help.

Open a support ticket