Using WooCommerce Subscriptions you get a “Thank you” message after purchasing a subscription product which says:
Your subscription will be activated when payment clears. View the status of your subscription in your account.
Do you know that you can change this text to the that best matches your style/site?
To do so, open the file functions.php located in wp-content/themes/your-theme-name/ and add this code at the end of it:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Change the subscription thank you message after purchase | |
* | |
* @param int $order_id | |
* @return string | |
*/ | |
function custom_subscription_thank_you( $order_id ){ | |
if( WC_Subscriptions_Order::order_contains_subscription( $order_id ) ) { | |
$thank_you_message = sprintf( __( '%sThank you for purchasign our subscription! Visit %syour account%s page to know its status.%s', 'woocommerce-subscriptions' ), '<p>', '<a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ) . '">', '</a>','</p>' ); | |
return $thank_you_message; | |
} | |
} | |
add_filter( 'woocommerce_subscriptions_thank_you_message', 'custom_subscription_thank_you'); |
Leave a Reply