fc_checkout_step_attributes
Type: Filter
Filters the HTML attributes of a checkout step element.
Signature
apply_filters( 'fc_checkout_step_attributes', $step_attributes, $step_id, $step_index, $context );
Parameters
| Name | Type | Description |
|---|---|---|
$step_attributes | array | Step attributes. |
$step_id | string | Checkout step ID. |
$step_index | int | Zero-based position of the step. |
$context | string | Context in which the hook runs. Default checkout. |
Since
4.0.0
Source: inc/checkout-steps.php
Examples
add_filter( 'fc_checkout_step_attributes',
/**
* Add custom attributes to checkout steps.
*
* @param array $step_attributes Step attributes.
* @param string $step_id Checkout step ID.
* @param int $step_index Zero-based position of the step.
* @param string $context Context in which the hook runs. Default checkout.
* @return array Filtered value.
*/
function( $step_attributes, $step_id, $step_index, $context ) {
$step_attributes['data-step-custom'] = 'value';
if ( 'contact' === $step_id ) {
$step_attributes['class'] .= ' custom-contact-step';
}
return $step_attributes;
},
10,
4
);