Skip to content

Instantly share code, notes, and snippets.

@rickgregory
rickgregory / wccptxt.php
Created April 12, 2024 23:50 — forked from Acephalia/wccptxt.php
Change WC Coupon Placeholder
function my_coupon_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Coupon code' :
$translated_text = __( 'My New Coupon Code Text', 'woocommerce' ); // Change text here
break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_coupon_strings', 10, 3 );
<?php
/* Changes the word Shipping to Delivery in the Woocommerce cart. Credit to Loictheaztec https://stackoverflow.com/a/53016991 */
add_filter('woocommerce_shipping_package_name', 'change_shipping_text_to_delivery', 20, 3 );
function change_shipping_text_to_delivery( $sprintf, $i, $package ) {
$sprintf = sprintf( _nx( 'Delivery', 'Delivery %d', ( $i + 1 ), 'delivery packages', 'woocommerce' ), ( $i + 1 ) );
return $sprintf;
}
?>