WooPayments Currency Switcher Shortcode

if ( ! function_exists( ‘rd_currency_switcher_shortcode’ ) ) { function rd_currency_switcher_shortcode( $atts ) { if ( ! function_exists( ‘wc_get_currency_switcher_markup’ ) ) { return ”; } // Attributes (defaults) $atts = shortcode_atts( array( ‘flag’ => ‘true’, ‘symbol’ => ‘true’, ‘select_border’ => ‘true’,…Continue reading

Rename WooCommerce “Coupon” terminology to “Discount”

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

Change WooCommerce Coupon Code Entry and Apply Button Text

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

Open WooCommerce Store Checkout Terms & Conditions in New Window

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

Create ‘Clear Cart’ URL Parameter

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

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

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

Register Sortable AutomateWoo Order Table Template [Requires Child Theme Files]

/** * 1) Register custom AutomateWoo product display template * 2) Sort items alphabetically when that template is used */ /* ——————————————— * 1) Register the new template for {{ order.items }} * ——————————————- */ add_filter( ‘automatewoo/variables/product_templates’, ‘rd_aw_register_product_templates’, 10 );…Continue reading

[Do not push] AutomateWoo Custom Function Align Subscription Renewal Date

function rd_align_subscription_next_payment( $workflow ) { if ( ! class_exists( ‘WooCommerce’ ) || ! function_exists( ‘wcs_get_subscription’ ) ) { return; } $subscription = $workflow->data_layer()->get_subscription(); if ( ! $subscription || ! is_a( $subscription, ‘WC_Subscription’ ) ) { wc_get_logger()->error( ‘No valid subscription found…Continue reading