Skip to content

Instantly share code, notes, and snippets.

@bradleysa
bradleysa / gist:e5bbf4aa7172d1f17530
Created December 7, 2014 08:00
WooCommerce: Remove default breadcrumbs and add Yoast ones instead
<?php
/**
* WooCommerce: Remove default breadcrumbs and add Yoast ones instead
* Add to theme functions.php file or Code Snippets plugin
*/
remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0);
add_action( 'woocommerce_before_main_content','my_yoast_breadcrumb', 20, 0);
if (!function_exists('my_yoast_breadcrumb') ) {
@bradleysa
bradleysa / gist:8b86fd66d0501a30bf87
Last active August 29, 2015 14:12
Highwind: Replace Footer Credits
<?php
// replace Footer Credits with a quote
function removeHighwindCredit() {
remove_action( 'highwind_footer', 'highwind_credit', 20 );
add_action( 'highwind_footer', 'my_footer_content' );
}
//add custom credits/text to the footer
function my_footer_content() {
@bradleysa
bradleysa / home-message
Created June 25, 2015 07:21
Storefront Theme: Header on Home: Text Widget
<div style="text-align: center; padding: .53em; color: #9A320D; font-weight: bold; font-size: 1.5em;"><span style="margin: 0 1em;">Gourmet marmalade & jam. Made in Santa Cruz.</span></div>
@bradleysa
bradleysa / gist:3cc0b5cf1d5d287a9ef5
Last active July 6, 2017 09:36
WooCommerce: Check if Coupon Already Applied
<?php
/**
* WooCommerce: Hide 'Coupon form' on checkout page if a coupon was already applied in the cart
* Add to theme functions.php file or Code Snippets plugin
*/
add_filter( 'woocommerce_coupons_enabled', 'woocommerce_coupons_enabled_checkout' );
function woocommerce_coupons_enabled_checkout( $coupons_enabled ) {
@bradleysa
bradleysa / gist:55a53d58e777f0a419218f17e13f6961
Created February 11, 2020 09:12
Storefront: Reduce Size of Logo Link Area
@media screen and (min-width: 481px) {
.woocommerce-active .site-header .site-branding {
width: 20%;
}
}
@bradleysa
bradleysa / gist:fc85630670143289238812c48d86500e
Created April 22, 2022 07:30
WooCommerce: Change add to cart button for variable product
/**
Change add to cart button for variable product
*/
add_filter('variable_add_to_cart_text', 'my_custom_cart_button_text');
function my_custom_cart_button_text() {
return __('Select Product', 'woocommerce');
}
@bradleysa
bradleysa / gist:82204368ac0ef82813f12480cc75e8c9
Created April 22, 2022 07:33
WC: Hide Coupon Field on Checkout Page
function hide_coupon_field_on_checkout( $enabled ) {
if ( is_checkout() ) {
$enabled = false;
}
return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_checkout' );
@bradleysa
bradleysa / gist:38855303c50d630e69f1a24c062d3d24
Created April 22, 2022 07:33
WC: Number of Related Products
function woo_related_products_limit() {
global $product;
$args['posts_per_page'] = 6;
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' );
function jk_related_products_args( $args ) {
$args['posts_per_page'] = 3; // 3 related products
@bradleysa
bradleysa / gist:21fcbff66acc5ed866343956aff1933c
Created April 22, 2022 07:35
WC: hide coupon field on Cart page
function hide_coupon_field_on_cart( $enabled ) {
if ( is_cart() ) {
$enabled = false;
}
return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_cart' );
@bradleysa
bradleysa / gist:43763a979ca13600cc8b9c81f6fbf858
Created April 22, 2022 07:37
WC: Remove all currency symbols
function sww_remove_wc_currency_symbols( $currency_symbol, $currency ) {
$currency_symbol = '';
return $currency_symbol;
}
add_filter('woocommerce_currency_symbol', 'sww_remove_wc_currency_symbols', 10, 2);
/** Source: https://jilt.com/blog/pricing-remove-currency-symbol/ **/