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 | |
// Do NOT include opening PHP tag above (<?php) | |
// Add to: | |
// - functions.php in child theme | |
// - Code Snippets | |
// - Settings > CheckoutWC > Premium Features > PHP Snippets (for Growth and Developer plans) | |
add_filter( 'cfw_hide_email_field_for_logged_in_users', '__return_false' ); |
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 |
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_filter( 'woocommerce_default_address_fields', 'custom_override_default_address_fields', 100000 + 100 ); | |
function custom_override_default_address_fields( $fields ) { | |
$fields['country']['class'] = array( 'cfw-force-hidden' ); | |
$fields['country']['columns'] = 0; | |
$fields['postcode']['columns'] = 6; | |
$fields['state']['columns'] = 6; | |
return $fields; |
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_filter( 'cfw_display_bump', function( $display_bump ) { | |
if ( ! class_exists( '\\WC_Subscriptions_Cart' ) ) { | |
return $display_bump; | |
} | |
if ( \WC_Subscriptions_Cart::cart_contains_subscription() ) { | |
return false; | |
} |
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 | |
function custom_output_pickup_instructions( \WC_Order $order ) { | |
$location = $order->get_meta( '_cfw_pickup_location', true ); | |
if ( empty( $location ) ) { | |
return; | |
} | |
$raw_address = get_post_meta( $location, 'cfw_pl_address', true ); |
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 | |
/** | |
* Instructions: cd into site directory | |
* | |
* Run `wp eval-file ./path/to/script.php` | |
*/ | |
global $wpdb; | |
// Query |
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 | |
// 2 - Above Mobile Coupons | |
// 7 - Above Payment Methods | |
// 15 - Above Billing Address Group | |
// 27 - Above Order Notes Field | |
// 35 - Above Terms and Conditions | |
add_action( 'cfw_checkout_payment_method_tab', function() { | |
echo '<h2>'Your Disclaimer and Other HTML</h2>'; | |
}, 2 ); |
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 using the Code Snippets plugin | |
// Do NOT include opening PHP tag above (<?php) | |
add_filter( | |
'woocommerce_default_address_fields', | |
function( $fields ) { | |
unset( $fields['postcode']['custom_attributes']['data-parsley-length'] ); | |
$fields['address_1']['custom_attributes']['data-parsley-pattern'] = '/^(?![A-Za-z][A-Ha-hJ-Yj-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2}).*$/'; | |
$fields['address_1']['custom_attributes']['data-parsley-error-message'] = __( 'Please enter a valid address.', 'your-translation-domain' ); |
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_action( | |
'wp_enqueue_scripts', | |
function() { | |
wp_deregister_script( 'af_ig-front' ); | |
}, | |
20 | |
); |
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 to CheckoutWC > Advanced > PHP Snippets | |
// You can also use the Code Snippets plugin | |
// Do NOT include opening PHP tag above (<?php) | |
/** | |
* Set a minimum order amount for checkout | |
*/ | |
add_action( 'woocommerce_checkout_process', 'wc_prevent_orders_under_minimum' ); | |
add_action( 'woocommerce_before_cart', 'wc_cart_minimum_order_amount' ); |