/** * FIX: Oversized Admin Bar Sync Icons * Version: 1.1 (Safe for all WordPress sites) * * For WPCode: * – Code Type: PHP Snippet * – Location: Admin Only (or Run Everywhere) * – Auto Insert: Yes */…Continue reading
/** * OFS Internal Categories Protection * * Any product in a category whose slug starts with “internal-” * will be: * – Not purchasable * – Have no price shown * – Have no Add to Cart button/text on…Continue reading
if ( class_exists( ‘WooCommerce’ ) ) { add_filter( ‘gettext’, ‘rd_wc_generic_coupon_replacement’, 20, 3 ); add_filter( ‘ngettext’, ‘rd_wc_generic_coupon_replacement_plural’, 20, 5 ); /** * Singular + general replacements */ function rd_wc_generic_coupon_replacement( $translated, $original, $domain ) { // Only change front-end + Woo emails…Continue reading
if ( class_exists( ‘WooCommerce’ ) ) { add_filter( ‘gettext’, ‘rd_wc_coupon_text_overrides’, 20, 3 ); function rd_wc_coupon_text_overrides( $translated, $original, $domain ) { // Only affect front-end Cart & Checkout if ( ! ( function_exists( ‘is_cart’ ) && function_exists( ‘is_checkout’ ) ) )…Continue reading
if ( class_exists( ‘WooCommerce’ ) ) { function rd_woocommerce_checkout_terms_and_conditions() { // Remove WooCommerce’s default T&C content output at priority 30 remove_action( ‘woocommerce_checkout_terms_and_conditions’, ‘wc_terms_and_conditions_page_content’, 30 ); } // Replace with New Window T&Cs – priority set at 31 in Snippet Settings…Continue reading
add_action( ‘template_redirect’, ‘logout_confirmation’ ); function logout_confirmation() { global $wp; if ( isset( $wp->query_vars[‘customer-logout’] ) ) { wp_redirect( str_replace( ‘&’, ‘&’, wp_logout_url( wc_get_page_permalink( ‘myaccount’ ) ) ) ); exit; } }Continue reading
if ( class_exists( ‘WooCommerce’ ) ) { add_action( ‘init’, function() { if ( isset( $_GET[‘clear-cart’] ) && $_GET[‘clear-cart’] === ‘true’ ) { if ( WC()->cart ) { WC()->cart->empty_cart(); } // Remove ?clear-cart=true from URL $clean_url = remove_query_arg( ‘clear-cart’ ); wp_safe_redirect(…Continue reading
if ( class_exists( ‘WooCommerce’ ) ) { // Add field add_filter( ‘woocommerce_shipping_fields’, function( $fields ) { $fields[‘shipping_phone’] = array( ‘label’ => __( ‘Phone (For Delivery Tracking SMS)’, ‘woocommerce’ ), ‘required’ => false, ‘class’ => array( ‘form-row-wide’ ), ‘priority’ => 120,…Continue reading
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
/** * Initialize custom meta fields for Audio > Speakers products. * * Applies to product_cat slugs: * – speakers * – full-range * – subwoofers * – monitors * – line-array * * Change the slugs in $speaker_category_slugs if…Continue reading