groundhogg/steps/run/do_step

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Filter Hooks

Β»

groundhogg/steps/run/do_step

Filters whether a funnel step should run for a contact. Return false to skip the step for a specific contact or condition without cancelling the event.

apply_filters( 'groundhogg/steps/run/do_step', $do_step, $step, $contact, $event );

You will receive the boolean run decision, the Step object, the Contact object, and the Event object.

Example

add_filter( 'groundhogg/steps/run/do_step', 'my_extension_skip_step_for_vips', 10, 4 );

/**
 * Skip a specific step for VIP contacts.
 *
 * @param bool                 $do_step
 * @param \Groundhogg\Step    $step
 * @param \Groundhogg\Contact $contact
 * @param \Groundhogg\Event   $event
 *
 * @return bool
 */
function my_extension_skip_step_for_vips( $do_step, $step, $contact, $event ) {
    if ( $step->get_id() === MY_EXTENSION_STEP_ID && $contact->has_tag( MY_EXTENSION_VIP_TAG_ID ) ) {
        return false;
    }

    return $do_step;
}

Was this helpful?

Let us know if this document answered your question. That’s the only way we can improve.