Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created January 19, 2026 12:43
Show Gist options
  • Select an option

  • Save xlplugins/de02a17ff1856c137c8cf551551d2900 to your computer and use it in GitHub Desktop.

Select an option

Save xlplugins/de02a17ff1856c137c8cf551551d2900 to your computer and use it in GitHub Desktop.
Change free shipping text in mini cart summary to "FREE pick-up at RMWSB" Only applies in the summary section, NOT in the shipping calculator
/**
* Change free shipping text in mini cart summary to "FREE pick-up at RMWSB"
* Only applies in the summary section, NOT in the shipping calculator
*/
add_filter( 'wc_cart_totals_shipping_method_cost', function( $output, $method ) {
// Safety checks: Only run on FunnelKit checkout pages
if ( ! class_exists( 'WFACP_Common' ) ) {
return $output;
}
// Check if we're on a FunnelKit checkout page
$wfacp_id = WFACP_Common::get_id();
if ( empty( $wfacp_id ) || $wfacp_id <= 0 ) {
return $output;
}
// Check if we're in the summary section (not shipping calculator)
// The summary uses cart-shipping.php template, calculator uses shipping-options-form.php
$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 10 );
$is_summary_section = false;
foreach ( $backtrace as $trace ) {
if ( isset( $trace['file'] ) ) {
// Check if called from cart-shipping.php (summary section)
if ( strpos( $trace['file'], 'cart-shipping.php' ) !== false ) {
$is_summary_section = true;
break;
}
// If called from shipping-options-form.php (calculator), skip
if ( strpos( $trace['file'], 'shipping-options-form.php' ) !== false ) {
return $output; // Don't modify in calculator
}
}
}
// Only modify if we're in the summary section
if ( ! $is_summary_section ) {
return $output;
}
// Check if it's free shipping method and has no cost
if ( $method && $method->get_method_id() === 'free_shipping' ) {
$has_cost = 0 < $method->cost;
// If there's no cost, replace the output
if ( ! $has_cost ) {
$output = 'FREE pick-up at RMWSB';
}
}
return $output;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment