promo_workflow_run

Triggered on application of promos to an order and allows application of additional promos.

Shop-Script

Input (passed by reference)

$params['order'] shopOrder Order properties object.
$params['active_promos'] array Active promos list.
… your plugin code …

Output

%plugin_id%

Associative array with the IDs of additional promos to be applied to an order as keys and sub-arrays of those promos’ tool IDs as values.

IDs of promo tools returned by plugins are currently not used by the app.

Shop-Script

Plugin code example

PHP

public function promoWorkflowRun($params)
{
    /** @var shopOrder $order */
    $order = $params['order'];

    $large_order_promos = [1, 2];
    $is_large_order = count($order->items) > 3;

    if ($is_large_order) {
        return array_fill_keys($large_order_promos, []);
    }
}