Skip to content

Instantly share code, notes, and snippets.

🌟
This is the way.

Luke Cavanagh lukecav

🌟
This is the way.
Block or report user

Report or block lukecav

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
@lukecav
lukecav / Links
Created Jan 15, 2020
Block XML-RPC but Allow for Jetpack IP ranges
View Links
@lukecav
lukecav / Link
Created Jan 15, 2020
Jetpack Hosting FAQ
View Link
@lukecav
lukecav / functions.php
Created Jan 11, 2020
Avoid Customer Data Being Updated After Checkout in WooCommerce
View functions.php
add_filter( 'woocommerce_checkout_update_customer_data', '__return_false' );
@lukecav
lukecav / functions.php
Created Jan 11, 2020
Disable Hover Zoom on Single Products in WooCommerce
View functions.php
add_filter( 'woocommerce_single_product_zoom_enabled', '__return_false' );
@lukecav
lukecav / functions.php
Created Jan 11, 2020
Change Add to Cart Text if the Product is Already in Cart in WooCommerce
View functions.php
// Conditional function that checks if a product is in cart and return the correct button text
function change_button_text( $product_id, $button_text ) {
foreach( WC()->cart->get_cart() as $item ) {
if( $product_id === $item['product_id'] ) {
return __('Already in Cart. Add again?', 'woocommerce');
}
}
return $button_text;
}
@lukecav
lukecav / functions.php
Created Jan 10, 2020
Hide Variation Product Title info from cart in WooCommerce
View functions.php
add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' );
@lukecav
lukecav / functions.php
Created Jan 10, 2020
Remove all attributes from showing in the additional info tab in WooCommerce
View functions.php
remove_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 );
@lukecav
lukecav / functions.php
Created Jan 10, 2020
Remove product dimensions from showing in the additional info tab in WooCommerce
View functions.php
add_filter( 'woocommerce_product_get_dimensions', '__return_false' );
@lukecav
lukecav / MySQL query
Created Jan 10, 2020
Add an index to the meta_value column in the postmeta database table in WordPress for db improvements
View MySQL query
ALTER TABLE `wp_postmeta` ADD INDEX `wp_postmeta_key_id` (`meta_key`,`post_id`);
@lukecav
lukecav / Command
Created Jan 7, 2020
Generate the product lookup tables using a WP-CLI command for WooCommerce
View Command
wp wc tool run regenerate_product_lookup_tables --user=1
You can’t perform that action at this time.