Have WooCommerce ‘Deliver to Different Address’ Checkbox Unticked by Default

if ( class_exists( ‘WooCommerce’ ) ) { add_filter( ‘woocommerce_ship_to_different_address_checked’, function( $checked ) { $checkout = WC()->checkout(); if ( ! $checkout ) { return $checked; } $shipping_first = $checkout->get_value( ‘shipping_first_name’ ); $shipping_last = $checkout->get_value( ‘shipping_last_name’ ); $shipping_addr_1 = $checkout->get_value( ‘shipping_address_1’ );…Continue reading

Show Certain Products to Certain Wholesale Customers Only

add_action( ‘pre_get_posts’, function ( WP_Query $query ) { // Only affect frontend main product queries (shop, category, etc.) if ( is_admin() || ! $query->is_main_query() || ‘product’ !== $query->get( ‘post_type’ ) ) { return; } $user_id = get_current_user_id(); // Admins /…Continue reading

WooCommerce AJAX Fix for RD Theme Live Cart Update

const DEBUG = false; // Set to true to enable console logs for debugging (function checkJQueryThenRun(retries = 10) { if (typeof jQuery === ‘undefined’) { if (DEBUG) console.warn(‘⏳ Waiting for jQuery…’); if (retries > 0) { setTimeout(() => checkJQueryThenRun(retries –…Continue reading