Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created April 1, 2026 07:36
Show Gist options
  • Select an option

  • Save webtoffee-git/3e0cd8a44065d132f86fe40c4a666ec9 to your computer and use it in GitHub Desktop.

Select an option

Save webtoffee-git/3e0cd8a44065d132f86fe40c4a666ec9 to your computer and use it in GitHub Desktop.
Replace “Buy X Get X/Y” with custom text in the Smart Coupons Basic plugin - By WebToffee (Smart Coupon Basic)
<?php //Do not copy this line of code
add_filter( 'wt_smart_coupon_meta_data', function ( $coupon_data, $coupon ) {
$coupon_id = isset( $coupon_data['coupon_id'] ) ? (int) $coupon_data['coupon_id'] : 0;
if ( ! $coupon_id || ! is_a( $coupon, 'WC_Coupon' ) ) {
return $coupon_data;
}
if ( 'wbte_sc_bogo' === $coupon->get_discount_type() ) {
$coupon_data['coupon_type'] = __( 'Redeem Now', 'wt-smart-coupons-for-woocommerce' );
}
return $coupon_data;
}, 20, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment