- This topic has 1 reply, 2 voices, and was last updated 2 years, 5 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Customize Message on coupon by URL
Hello,
I’d like to change the default message “coupon has been applied” that appears on the product page after using the coupon by url.
In “Miscellaneaus” I cant set a message when the coupon is still invalid, but if the coupon applies only by adding 1 product, then the user will never see the custom message i set in there, so I’d like to show a custom one when see the product page.
How to do it? I can’t edit the PO file since the coupon value vary.
May we add a parameter in the URL for showing that?
Thanks for your help
You can use this PHP snippet for that:
add_filter(
'woocommerce_coupon_message',
function( $msg, $msg_code, $coupon ) {
if ( $coupon->get_code() === 'MY COUPON' && $msg_code == WC_Coupon::WC_COUPON_SUCCESS ) {
$msg = 'You coupon has been applied!';
}
return $msg;
}, 10, 3 );
(Untested)