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 | |
/** | |
* 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 | |
add_action( | |
'cfw_side_cart_notices', | |
function() { | |
// Catch any messages the hook creates | |
add_filter( 'woocommerce_add_error', 'catch_errors_and_queue_for_cfw' ); | |
add_filter( 'woocommerce_add_success', 'catch_success_and_queue_for_cfw' ); | |
add_filter( 'woocommerce_add_notice', 'catch_notices_and_queue_for_cfw' ); | |
// Prevent notices from being output/cleared on woocommerce_before_cart |
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
// Add to WP Admin > CheckoutWC > Advanced > Scripts > PHP Snippets | |
remove_action( 'woocommerce_checkout_after_order_review', 'woocommerce_checkout_payment', 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( | |
'cfw_display_bump', | |
function() { | |
return ! is_checkout(); | |
} | |
); |
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_thank_you_cart_summary', 'my_thank_you_shortcode_wrapped', 65 ); | |
function my_thank_you_shortcode_wrapped() { | |
cfw_thank_you_section_auto_wrap( | |
function() { | |
echo do_shortcode( '[your_shortcode]' ); | |
}, | |
'my-shortcode-section' | |
); |
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 | |
/** | |
* Handling long state labels | |
* | |
* Example: German state field label exceeds state field container ("Bundesland / Landkreis (optional)") | |
*/ | |
// Option 1: Rearrange address fields to make state field wider | |
add_filter( | |
'woocommerce_default_address_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_shipping_total_not_available_text', | |
function () { | |
return 'My custom no shipping message.'; | |
} | |
); |
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_disable_side_cart', | |
function() { | |
return boolval( preg_match( "/^\/the-page-slug/", $_SERVER['REQUEST_URI'] ) ); | |
} | |
); |