Skip to content

Instantly share code, notes, and snippets.

@bradleysa
bradleysa / gist:475163526fbce561edfb15bdd0a91f8f
Created April 22, 2022 08:17
WC: Change Number of Cross-Sells on Cart Page
add_filter( 'woocommerce_cross_sells_total', 'bbloomer_change_cross_sells_product_no' );
function bbloomer_change_cross_sells_product_no( $columns ) {
return 2;
}
/** https://www.businessbloomer.com/woocommerce-move-change-number-cross-sells-cart-page/ **/
@bradleysa
bradleysa / gist:85b85e1abef253af22df5bbe6acfa1f2
Created April 22, 2022 08:17
WC: Remove Product Images from Cart
add_filter( 'woocommerce_cart_item_thumbnail', '__return_false' );
/** https://www.skyverge.com/blog/remove-woocommerce-product-images-from-the-cart/ **/
@bradleysa
bradleysa / gist:8efb9cdd2e768cffdbccdba43940c59e
Created April 22, 2022 08:16
WC: Remove Cart Item Permalink
add_filter( 'woocommerce_cart_item_permalink', '__return_null' );
/** https://www.businessbloomer.com/woocommerce-remove-cart-product-link-cart-page/ **/
@bradleysa
bradleysa / gist:120ff0f926d89bc0b585020b03ec590a
Created April 22, 2022 08:15
WC: Remove 'What is PayPal?' and CC logos
add_filter( 'woocommerce_gateway_icon', 'wpglorify_remove_what_is_paypal', 10, 2 );
function wpglorify_remove_what_is_paypal( $icon_html, $gateway_id ) {
if( 'paypal' == $gateway_id ) {
$icon_html = '<img src="/wp-content/plugins/woocommerce/includes/gateways/paypal/assets/images/paypal.png" alt="PayPal Acceptance Mark">';
}
return $icon_html;
}
/** https://wpglorify.com/woocommerce-remove-what-is-paypal/ **/
@bradleysa
bradleysa / gist:d327d79d8fe3714d06d2369f2587856d
Created April 22, 2022 08:14
Disable Automatic Updates for WordPress Plugins (UI)
add_filter( 'plugins_auto_update_enabled', '__return_false' );
/** https://woorkup.com/wordpress-disable-automatic-updates/ **/
@bradleysa
bradleysa / gist:44e8dfc6bd8736905a455ebb701e7899
Created April 22, 2022 08:14
Disable Automatic Updates for WordPress Themes (UI)
add_filter( 'themes_auto_update_enabled', '__return_false' );
/** https://woorkup.com/wordpress-disable-automatic-updates/ **/
@bradleysa
bradleysa / gist:ec5b4a2b9371db7158eb9cccb3c0f336
Created April 22, 2022 08:13
Jetpack: Remove Ads from Dashboard
add_filter( 'jetpack_just_in_time_msgs', '__return_false' );
/** https://businessbloomer.com/woocommerce-remove-jetpack-ads-wp-dashboard/ **/
@bradleysa
bradleysa / gist:b10d040875cb18517febbc767958233e
Created April 22, 2022 08:12
WC: rename 'Have a Coupon' on Checkout page
// rename the "Have a Coupon?" message on the checkout page
function woocommerce_rename_coupon_message_on_checkout() {
return 'Got a coupon? Score!' . ' <a href="#" class="showcoupon">' . __( 'Redeem it here.', 'woocommerce' ) . '</a>';
}
add_filter( 'woocommerce_checkout_coupon_message', 'woocommerce_rename_coupon_message_on_checkout' );
// rename the coupon field on the checkout page
function woocommerce_rename_coupon_field_on_checkout( $translated_text, $text, $text_domain ) {
@bradleysa
bradleysa / gist:787baa1f4b5d61885069535a6538b41d
Created April 22, 2022 08:12
WC: default state and country
add_filter( 'default_checkout_country', 'change_default_checkout_country' );
add_filter( 'default_checkout_state', 'change_default_checkout_state' );
function change_default_checkout_country() {
return 'US'; // country code
}
function change_default_checkout_state() {
return 'CA'; // state code
}
@bradleysa
bradleysa / gist:016315ed1e0e51e31c319bc2d985547a
Created April 22, 2022 08:11
Remove menu links from the Admin menu
add_action( 'admin_menu', 'remove_menus', 999 );
function remove_menus() {
remove_menu_page( 'edit-comments.php' );
}