You can program the Order Complete email by overriding the template.
WooCommerce has instructions on how to override the template here:
https://woocommerce.com/posts/how-to-customize-emails-in-woocommerce/
Once you have overridden the template, you will have to write code to examine the contents of the Order. Loop over each order item and check to see if it is a gift card product by doing something like this:
if ( is_a( $product, 'WC_Product_PW_Gift_Card' ) ) {
// Do something
}
This is not specific to the gift card plugin and would be outside the scope of what support we can provide so I’m marking the thread as resolved but let us know if you have any other questions!
Ok thank you for the information! I will look into this.
Also, I am using the code below to change the subject line of the order complete emails when a gift card is added. When there isn’t one included though, the subject line is blank. Do you know what might be causing this?
function woocommerce_custom_email_subject_per_product_depending_on_product_id( $subject, $order ) {
global $woocommerce;
$items = $order->get_items();
foreach ( $items as $item ) {
$product_id = $item['product_id'];
if ( $product_id == 5354 ) {
$subject = 'Your order receipt';
}
return $subject;
}
}
add_filter( 'woocommerce_email_subject_customer_completed_order', 'woocommerce_custom_email_subject_per_product_depending_on_product_id', 10, 5 );
Looks like the “return $subject;” line is inside the foreach loop. Try this code instead and see if it does the trick:
function woocommerce_custom_email_subject_per_product_depending_on_product_id( $subject, $order ) {
global $woocommerce;
$items = $order->get_items();
foreach ( $items as $item ) {
$product_id = $item['product_id'];
if ( $product_id == 5354 ) {
$subject = 'Your order receipt';
}
break;
}
return $subject;
}
That fixed it, thank you so much!