Template – Gift Card Email

You can fully customize the gift card email to suit your needs. We use the built in WooCommerce email template system. To override the email follow these steps:

1. Log into your WordPress admin area.
2. Click on WooCommerce -> Settings -> Emails -> PW Gift Card Email
3. Under the “HTML Template” section, click “Copy file to theme”
4. Once the file is in your theme folder, open it up in a text editor and make any changes. You can change colors, wording, etc.

If you have trouble with Step 3, you can manually copy this file:

/wp-content/plugins/pw-woocommerce-gift-cards/templates/woocommerce/emails/customer-pw-gift-card.php

To here (you may need to create the subfolders if they do not exist in your theme folder):

/wp-content/themes/<your-active-theme>/woocommerce/emails/customer-pw-gift-card.php

You can find out more about customization here:
https://docs.woocommerce.com/document/configuring-woocommerce-settings/#section-21

Here are some examples of adding information to the template.

Adding the Product Title
<div class="pwgc-email-section">
    <?php
        $product = property_exists( $item_data, 'product' ) && is_a( $item_data->product, 'WC_Product' ) ? $item_data->product : pwgc_get_gift_card_product();
        echo 'Product: ' . esc_html( $product->get_title() );
    ?>
</div>
Product description (parent Variable product)
<?php
    if ( property_exists( $item_data, 'parent_product' ) && is_a( $item_data->parent_product, 'WC_Product_PW_Gift_Card' ) ) {
        echo $item_data->parent_product->get_description();
    }
?>
Variation description
<?php
    if ( property_exists( $item_data, 'product' ) && is_a( $item_data->product, 'WC_Product' ) ) {
        echo $item_data->product->get_description();
    }
?>
Order Data
<?php
    if ( !empty( $item_data->order ) ) {
        ?>
        <div class="pwgc-section">
            <div class="pwgc-label">Order Number</div>
            <div class="pwgc-expiration-date"><?php echo $item_data->order->get_order_number(); ?></div>
        </div>

        <div class="pwgc-section">
            <div class="pwgc-label">Order Date</div>
            <div class="pwgc-expiration-date"><?php echo $item_data->order->get_date_created(); ?></div>
        </div>
        <?php
    }
?>
Product Image (main product)
<?php
    if ( property_exists( $item_data, 'parent_product' ) && is_a( $item_data->parent_product, 'WC_Product' ) ) {
        $image = wp_get_attachment_image_src( get_post_thumbnail_id( $item_data->parent_product->get_id() ), 'single-post-thumbnail' );
        if ($image) {
            ?>
            <img src="<?php echo $image[0]; ?>">
            <?php
        }
    }
?>
Variation Image
<?php
    if ( property_exists( $item_data, 'product' ) && is_a( $item_data->product, 'WC_Product' ) ) {
        $image = wp_get_attachment_image_src( get_post_thumbnail_id( $item_data->product->get_id() ), 'single-post-thumbnail' );
        if ($image) {
            ?>
            <img src="<?php echo $image[0]; ?>">
            <?php
        }
    }
?>
Recipient Email Address
<?php
    if ( !empty( $email->recipient ) ) {
        echo $email->recipient;
    }
?>
Skip to content