Skip to content

Instantly share code, notes, and snippets.

Clifton Griffin clifgriffin

Block or report user

Report or block clifgriffin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@clifgriffin
clifgriffin / custom-header.php
Last active Sep 17, 2019
A simple example of how to add a custom header to Checkout for WooCommerce.
View custom-header.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_action( 'cfw_before_header', function() {
?>
<!-- Some custom CSS for your new header -->
<style type="text/css">
#cfw-header {
display: none;
@clifgriffin
clifgriffin / change-header-link.php
Last active Sep 6, 2019
How to change header title / logo link URL for Checkout for WooCommerce.
View change-header-link.php
@clifgriffin
clifgriffin / address-autocomplete-country-restrictions.php
Last active Aug 22, 2019
Add country restrictions to address autocomplete for Checkout for WooCommerce.
View address-autocomplete-country-restrictions.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
// Restrict address autocomplete shipping countries to US
// NOTE: Google only allows up to 5 country restrictions
add_filter( 'cfw_address_autocomplete_shipping_countries', function() {
return array( 'us' );
} );
@clifgriffin
clifgriffin / reorder-address-fields.php
Created Aug 21, 2019
How to reorder address fields for Checkout for WooCommerce.
View reorder-address-fields.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_action( 'woocommerce_default_address_fields', 'cfw_reorder_address_fields', 100000 + 10 );
function cfw_reorder_address_fields( $fields ) {
$fields['city']['priority'] = 50;
$fields['city']['columns'] = 4;
$fields['state']['priority'] = 60;
@clifgriffin
clifgriffin / highlight-countries.php
Created Jul 25, 2019
How to highlight certain countries in countries select dropdown for Checkout for WooCommerce.
View highlight-countries.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_filter( 'cfw_highlighted_countries', function( $highlighted_countries ) {
$highlighted_countries[] = 'US';
$highlighted_countries[] = 'GB'; // UK
return $highlighted_countries;
} );
@clifgriffin
clifgriffin / change-return-to-cart-link.php
Created Jul 24, 2019
Change return to cart label and link.
View change-return-to-cart-link.php
@clifgriffin
clifgriffin / move-phone-field.php
Created Jul 23, 2019
Move Checkout for WooCommerce phone field.
View move-phone-field.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_filter( 'woocommerce_default_address_fields', 'move_phone_fields', 100001 );
function move_phone_fields( $fields ) {
if ( isset( $fields['phone'] ) ) {
$fields['phone']['priority'] = 14;
}
@clifgriffin
clifgriffin / change-promo-code-label.php
Created Jul 23, 2019
Change promo code label for Checkout for WooCommerce.
View change-promo-code-label.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_filter( 'cfw_promo_code_label', function() {
return 'Enter Code if Applicable';
} );
View change-free-shipping-label.php
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
add_filter( 'woocommerce_cart_shipping_total', function( $total ) {
if ( $total == 'Free!' ) {
$total = '0.00';
}
return $total;
@clifgriffin
clifgriffin / hide-cart-links.css
Created Jul 3, 2019
Hide cart links for CheckoutWC.
View hide-cart-links.css
You can’t perform that action at this time.