Last active
May 24, 2023 02:28
-
-
Save clifgriffin/dbf6a26b2ee82787eac9a837f96f45d3 to your computer and use it in GitHub Desktop.
Add additional tab to CheckoutWC checkout flow for WooCommerce.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add to functions.php or with your favorite Code Snippets plugin | |
// Do not include opening PHP tag (<?php) | |
add_filter( 'cfw_get_checkout_tabs', 'add_age_verification_checkout_step' ); | |
function add_age_verification_checkout_step( $tabs ) { | |
/** | |
* Tab Priorities | |
* - Customer Info: 20 | |
* - Shipping Method: 30 | |
* - Payment Method: 40 | |
*/ | |
$tabs['age_verification'] = array( | |
'label' => 'Age Verification', | |
'classes' => array(), | |
'priority' => 25, // Between information and shipping method | |
'enabled' => true, | |
'display_callback' => 'cfw_display_age_verification_checkout_step', | |
); | |
return $tabs; | |
} | |
function cfw_display_age_verification_checkout_step() { | |
?> | |
<h1>How old are you?</h1> | |
<p>Listen kid, aren't you a bit young to be hanging out around here? Where are your parents?</p> | |
<div class="cfw-bottom-controls"> | |
<div class="previous-button"> | |
<?php cfw_return_to_customer_information_link(); ?> | |
</div> | |
<?php cfw_continue_to_shipping_button(); ?> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment