This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Fix WooCommerce Customer Data Display | |
* | |
* Add this code to your theme's functions.php file or as a small custom plugin. | |
* After adding, visit any page in your WordPress admin to trigger the fix. | |
* Once the tables are regenerated, you can safely remove this code. | |
*/ | |
// Only run in admin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Mark renewal orders as not requiring shipping for subscriptions with one-time shipping enabled. | |
*/ | |
function wooninja_mark_renewal_orders_virtual( $renewal_order, $subscription ) { | |
// Check if this is a renewal order | |
if ( wcs_order_contains_renewal( $renewal_order->get_id() ) ) { | |
// Get all line items from the order | |
$items = $renewal_order->get_items(); | |
$needs_shipping = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fix for WooCommerce product_brand_thumbnails shortcode | |
* | |
* This snippet fixes an issue in the WooCommerce Brands where using | |
* show_empty="false" parameter breaks the shortcode in WooCommerce versions newer than 9.9.3. | |
* | |
* The issue occurs because of double filtering of empty brands in the output_product_brand_thumbnails function. | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Limit WooCommerce password reset attempts to 3 per hour per user+IP | |
*/ | |
add_action( 'lostpassword_post', 'limit_wc_password_reset_attempts', 10, 2 ); | |
function limit_wc_password_reset_attempts( $errors, $user_data ) { | |
// If there's no user data or errors already exist, don't proceed | |
if ( ! $user_data || $errors->has_errors() ) { | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Hide price if it's set to zero | |
*/ | |
function a8c_hide_zero_prices( $price, $product ) { | |
if ( '' === $product->get_price() || 0 == $product->get_price() ) { | |
$price = ''; | |
} | |
return $price; | |
} | |
add_filter( 'woocommerce_get_price_html', 'a8c_hide_zero_prices', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Force hide disabled variations even when "Any" is used | |
*/ | |
add_filter('woocommerce_variation_is_visible', function($visible, $variation_id) { | |
$variation = wc_get_product($variation_id); | |
// If variation is disabled (not published), hide it regardless of "Any" settings | |
if ($variation && $variation->get_status() !== 'publish') { | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Force a recount of all brand terms | |
*/ | |
function recount_brand_terms() { | |
// Only run on the homepage | |
if ( !is_front_page() && !is_home() ) { | |
return; | |
} | |
// Check if the product_brand taxonomy exists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Debug code for iDEAL refund issue | |
* | |
* This file contains diagnostic code to help identify why the iDEAL refund | |
* option is missing in WooCommerce Stripe Gateway. Add this to your theme's | |
* functions.php to see the debugging output in the HTML source. | |
*/ | |
// Debug code to check if iDEAL gateway is properly registered | |
add_action('init', function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Solution for WooCommerce Stripe iDEAL Refund | |
* | |
* This code adds a "Refund via iDEAL" button to WooCommerce orders paid with iDEAL, | |
* even when the Stripe gateway isn't properly registered. | |
*/ | |
add_action('woocommerce_order_item_add_action_buttons', function($order) { | |
if ($order->get_payment_method() !== 'stripe_ideal') { | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fix for WooCommerce login form Enter key not working when registration is disabled | |
* This is a temporary fix until WooCommerce 9.9.9 is released (June 2, 2025) | |
*/ | |
function fix_woocommerce_login_enter_key() { | |
// Only add this script on pages that might have the login form | |
if (!is_account_page() && !is_checkout()) { | |
return; | |
} | |
NewerOlder