Last active
October 15, 2024 06:25
-
-
Save braddalton/60fc54c47449109e742d3587575b5928 to your computer and use it in GitHub Desktop.
Add custom HTML to the WooCommerce order confirmation email and thank you page
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
// Add custom HTML to the WooCommerce thank you page | |
add_action('woocommerce_thankyou', 'custom_html_confirmation_page_1001'); | |
function custom_html_confirmation_page_1001($order_id) { | |
$order = wc_get_order($order_id); | |
echo '<div class="custom-confirmation-message">'; | |
echo '<h2>Thank you for your purchase!</h2>'; | |
echo '<p>Your order number is: ' . $order->get_order_number() . '</p>'; | |
echo '<p>We appreciate your business and will send you a confirmation email shortly.</p>'; | |
echo '</div>'; | |
} | |
// Add custom HTML to the WooCommerce order confirmation email | |
add_action('woocommerce_email_order_details', 'custom_html_confirmation_email_1001', 10, 4); | |
function custom_html_confirmation_email_1001($order, $sent_to_admin, $plain_text, $email) { | |
if (!$sent_to_admin && $email->id === 'customer_processing_order') { | |
echo '<div class="custom-email-message">'; | |
echo '<h2>Thank you for shopping with us!</h2>'; | |
echo '<p>Your order number is: ' . $order->get_order_number() . '</p>'; | |
echo '<p>We are preparing your order for shipment and will update you with tracking details soon.</p>'; | |
echo '</div>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment