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_filter( 'cfw_cart_totals_shipping_label', function( $label ) { | |
$chosen_shipping_methods_labels = array(); | |
$packages = WC()->shipping->get_packages(); | |
foreach ( $packages as $i => $package ) { | |
$chosen_method = WC()->session->get( 'chosen_shipping_methods' )[ $i ] ?? 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 | |
// Do NOT include the opening php tag. | |
// Place in your theme's functions.php file | |
add_action( 'cfw_custom_header', function() { | |
?> | |
<!-- Some custom CSS for your new header --> | |
<style type="text/css"> | |
nav a { | |
font-weight: bold; |
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_field_data_persistence_excludes', function( $excludes ) { | |
$excludes[] = '#terms'; | |
return $excludes; | |
} ); |
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 | |
/* | |
* In CheckoutWC's Delivery method, hide the Shipping option completely when at least | |
* one product in the cart is assigned to a specific category. | |
* | |
* @author Obi Juan <hola@obijuan.dev> | |
* @link https://obijuan.dev | |
*/ | |
/* |
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 | |
/** | |
* Enable ACR cart tracking without published emails | |
* | |
* Add to your child theme's functions.php file or to WP Admin > CheckoutWC > Advanced > Scripts > PHP Snippets | |
* Do NOT include the opening PHP tag above (<?php) | |
*/ | |
add_filter( 'cfw_acr_track_cart_without_emails', '__return_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 | |
// Do NOT include the opening php tag. | |
// Place in your theme's functions.php file | |
add_filter( 'woocommerce_new_customer_data', function( $data ) { | |
$data['user_login'] = $data['user_email']; | |
return $data; | |
} ); |
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 the opening php tag. | |
// Place in your theme's functions.php file | |
add_filter( 'cfw_get_billing_checkout_fields', 'remove_checkout_fields', 100 ); | |
function remove_checkout_fields( $fields ) { | |
unset( $fields['billing_company'] ); | |
unset( $fields['billing_city'] ); | |
unset( $fields['billing_postcode'] ); |
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 | |
/** | |
* The following code MUST be deployed in an MU plugin to work | |
*/ | |
add_action( 'cfw_init_ab_tests', function() { | |
cfw_register_ab_test( 'cfw_disabled', 'example_set_cfw_disabled' ); | |
// To enable the test progamatically, you would use this call: | |
cfw_activate_ab_test( 'cfw_disabled' ); |
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 | |
/** | |
* Output custom HTML below the CheckoutWC cart summary | |
*/ | |
add_action( 'cfw_after_cart_summary', function() { | |
?> | |
<div class="example-container-class"> | |
<h2>A heading!</h2> | |
<p>A paragraph tag.</p> | |
<p>A paragraph tag with inline PHP: <?php echo 'Inline PHP!'; ?></p> |
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( 'cfw_checkout_customer_info_tab', function () { | |
if ( function_exists( 'autoship_cart_has_valid_autoship_items' ) && autoship_cart_has_valid_autoship_items() ) { | |
remove_action( 'cfw_checkout_customer_info_tab', 'cfw_payment_request_buttons', 10 ); | |
} | |
}, 0 ); |
NewerOlder