Skip to main content

fc_checkout_start_step

Type: Action

Fires at the start of a checkout step, inside the step element.

Signature​

do_action( 'fc_checkout_start_step', $step_id, $step_args, $step_index, $context );

Parameters​

NameTypeDescription
$step_idstringCheckout step ID.
$step_argsarrayCheckout step arguments.
$step_indexintZero-based position of the step.
$contextstringContext in which the hook runs. Default checkout.

Since​

  • 4.0.0

Source: inc/checkout-steps.php

Examples​

add_action( 'fc_checkout_start_step',
/**
* Add dynamic wrapper div to checkout steps.
*
* @param string $step_id Checkout step ID.
* @param array $step_args Checkout step arguments.
* @param int $step_index Zero-based position of the step.
* @param string $context Context in which the hook runs. Default checkout.
*/
function( $step_id, $step_args, $step_index, $context ) {
// Build dynamic classes
$classes = array(
'fc-step-wrapper',
'fc-step-' . $step_id,
'fc-step-index-' . $step_index
);

// Add context class if not default
if ( $context !== 'checkout' ) {
$classes[] = 'fc-step-context-' . $context;
}

printf( '<div class="%s" data-step="%s">',
esc_attr( implode( ' ', $classes ) ),
esc_attr( $step_id )
);
},
10,
4
);