groundhogg/step/can_complete

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Filter Hooks

Β»

groundhogg/step/can_complete

Filters whether a benchmark step can be completed for a contact. Return true to allow a contact to enter a funnel at this benchmark.

apply_filters( 'groundhogg/step/can_complete', $can_complete, $step, $contact );

You will receive the current boolean, the Step object, and the Contact object.

Example

add_filter( 'groundhogg/step/can_complete', 'my_extension_restrict_benchmark', 10, 3 );

/**
 * Only allow the benchmark to complete for contacts from a specific country.
 *
 * @param bool                 $can_complete
 * @param \Groundhogg\Step    $step
 * @param \Groundhogg\Contact $contact
 *
 * @return bool
 */
function my_extension_restrict_benchmark( $can_complete, $step, $contact ) {
    if ( $step->get_id() !== MY_EXTENSION_BENCHMARK_ID ) {
        return $can_complete;
    }

    return $contact->get_meta( 'country' ) === 'CA';
}

Was this helpful?

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