Skip to content

Instantly share code, notes, and snippets.

View geeklore's full-sized avatar

Shane Eckert geeklore

View GitHub Profile
@geeklore
geeklore / wc-add-message-login-form.php
Created March 6, 2019 19:51
WooCommerce Add a message above the login / register form on my-account page
/**
* Add a message above the login / register form on my-account page
*/
add_action( 'woocommerce_before_customer_login_form', 'jk_login_message' );
function jk_login_message() {
if ( get_option( 'woocommerce_enable_myaccount_registration' ) == 'yes' ) {
?>
<div class="woocommerce-info">
<p><?php _e( 'Returning customers login. New users register for next time so you can:' ); ?></p>
<ul>
@geeklore
geeklore / rawwc-remove-breadcrumbs-wc-pages.php
Created March 6, 2019 19:49
Remove breadcrumbs on specific pages
/**
* Remove breadcrumbs on specific pages
*/
add_action( 'init', 'wcc_remove_woo_wc_breadcrumbs' );
function wcc_remove_woo_wc_breadcrumbs() {
if ( is_woocommerce() || is_cart() || is_checkout() ) {
remove_action( 'woo_main_before', 'woo_display_breadcrumbs', 10 );
}
}
@geeklore
geeklore / wc-remove-breadcrumbs-woo-theme.php
Created March 6, 2019 19:49
Remove breadcrumbs in Woo developed themes
/**
* Remove breadcrumbs in Woo developed themes
*/
add_action( 'init', 'woo_remove_woo_breadcrumbs' );
function woo_remove_woo_breadcrumbs() {
remove_action( 'woo_main_before', 'woo_display_breadcrumbs', 10 );
}
@geeklore
geeklore / wc-remove-storefront-breadcrumbs.php
Created March 6, 2019 19:48
WooCommerce Storefront theme remove breadcrumbs
/**
* Remove breadcrumbs for Storefront theme
*/
add_action( 'init', 'wc_remove_storefront_breadcrumbs');
function wc_remove_storefront_breadcrumbs() {
remove_action( 'storefront_before_content', 'woocommerce_breadcrumb', 10 );
}
@geeklore
geeklore / wc-remove-breadcrumbs.php
Created March 6, 2019 19:47
WooCommerce Remove the breadcrumbs
/**
* Remove the breadcrumbs
*/
add_action( 'init', 'woo_remove_wc_breadcrumbs' );
function woo_remove_wc_breadcrumbs() {
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}
@geeklore
geeklore / wc-change-home-link.php
Created March 6, 2019 19:46
Customize the WooCommerce breadcrumb - Change the home link to a different URL
@geeklore
geeklore / wc-change-all-the-things.php
Created March 6, 2019 19:45
Customize the WooCommerce breadcrumb - Change all the things
/**
* Change several of the breadcrumb defaults
*/
add_filter( 'woocommerce_breadcrumb_defaults', 'jk_woocommerce_breadcrumbs' );
function jk_woocommerce_breadcrumbs() {
return array(
'delimiter' => ' &#47; ',
'wrap_before' => '<nav class="woocommerce-breadcrumb" itemprop="breadcrumb">',
'wrap_after' => '</nav>',
'before' => '',
@geeklore
geeklore / wc-change-breadcrumb-separator.php
Created March 6, 2019 19:44
Customize the WooCommerce breadcrumb - Change the breadcrumb separator
/**
* Change the breadcrumb separator
*/
add_filter( 'woocommerce_breadcrumb_defaults', 'wcc_change_breadcrumb_delimiter' );
function wcc_change_breadcrumb_delimiter( $defaults ) {
// Change the breadcrumb delimeter from '/' to '>'
$defaults['delimiter'] = ' &gt; ';
return $defaults;
}
@geeklore
geeklore / wc-customize-breadcrumb.php
Created March 6, 2019 19:42
Customize the WooCommerce breadcrumb - Change the ‘Home’ text
/**
* Rename "home" in breadcrumb
*/
add_filter( 'woocommerce_breadcrumb_defaults', 'wcc_change_breadcrumb_home_text' );
function wcc_change_breadcrumb_home_text( $defaults ) {
// Change the breadcrumb home text from 'Home' to 'Apartment'
$defaults['home'] = 'Apartment';
return $defaults;
}
@geeklore
geeklore / wc-delivery-counrty-surcharge.php
Created March 6, 2019 19:39
Add a surcharge based on the delivery country
/**
* Add a 1% surcharge to your cart / checkout based on delivery country
* Taxes, shipping costs and order subtotal are all included in the surcharge amount
*/
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
global $woocommerce;
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;