Title: Order date + 1 year
Last modified: April 21, 2021

---

# Order date + 1 year

 *  Resolved [massdoo11](https://wordpress.org/support/users/massdoo11/)
 * (@massdoo11)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/)
 * Hello,
 * I would like to display on my invoice “Membership valid until : ”
 * I would like to add 365 days to the order date (membership is valid for 1 year)
 * Can you help me?
    Thank you in advance,
 * Have a nice day

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Contributor [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * (@yordansoares)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14346503)
 * Hello [@massdoo11](https://wordpress.org/support/users/massdoo11/),
 * You can add custom fields to your invoices using the [template action hooks](https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/pdf-template-action-hooks/).
   See several examples about adding new fields to your invoices [here](https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/pdf-template-action-hooks/#example-1-print-a-delivery-date-on-the-packing-slip).
 * Let’s say your membership date is stored in the order metadata `membership_expiry_date`,
   then you could add this field to your invoces using the following code snippet:
 *     ```
       add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_delivery_date', 10, 2 );
       function wpo_wcpdf_delivery_date ($template_type, $order) {
           $document = wcpdf_get_document( $template_type, $order );
           if ($template_type == 'invoice') {
               ?>
               <tr class="membership-notice">
                   <th>Membership valid until:</th>
                   <td><?php $document->custom_field('membership_expiry_date'); ?></td>
               </tr>
               <?php
           }
       }
       ```
   
 * You can also add any field, without no code, using [Premium Templates](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/).
   This extension includes a customizer that allows you to tailor your PDF documents
   using product columns, total rows, and [custom blocks](https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/using-custom-blocks/).
   In addition, Premium Templates provides two additional templates: [Business](https://wpovernight.com/wp-content/uploads/edd/2017/09/business-invoice-1.jpg)
   and [Modern](https://wpovernight.com/wp-content/uploads/edd/2017/09/modern-invoice-1.jpg).
 * For your specific case, you only need to add a custom, block this way:
 * ![The screenshot display a custom block](https://i0.wp.com/i.imgur.com/4kHSPxo.
   png?ssl=1)
 * Then, your invoices will display your custom field:
 * ![The screenshot display an invoice showing the custom field](https://i0.wp.com/
   i.imgur.com/bmdY5sc.png?ssl=1)
 * If you don’t know the name of your custom field, see [Finding WooCommerce custom fields](https://docs.wpovernight.com/general/finding-woocommerce-custom-fields/)
 * Let me know if you have more questions 🙂
 *  Plugin Contributor [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * (@yordansoares)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14346780)
 * Sorry [@massdoo11](https://wordpress.org/support/users/massdoo11/),
 * I read your message again, and I realized that you want to show 1 year difference
   since the order date.
 * To achieve that, you can use this placeholder instead: `{{order_date|+1 year}}`
 * ![A screenshot that display a custom block using the order date plus one year](
   https://i0.wp.com/i.imgur.com/F9LI5Px.png?ssl=1)
 * Then, your invoices will display the new line with exactly +1 year:
 * ![A screenshot that display a a new fields on the invoice](https://i0.wp.com/
   i.imgur.com/E2i99KT.png?ssl=1)
 * On the invoice you can see:
 * 1. The order price
    2. The new field with the `{{order_date|+1 year}}` output
 * Let me know if you have more questions 😉
 *  Thread Starter [massdoo11](https://wordpress.org/support/users/massdoo11/)
 * (@massdoo11)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14346784)
 * thank you very much for your answer
 * I just inserted your code in the theme-functions of my email.
 * But the date is not displayed…
 * View image : [https://pasteboard.co/JYmdpFT.png](https://pasteboard.co/JYmdpFT.png)
 * Thanks
 *  Thread Starter [massdoo11](https://wordpress.org/support/users/massdoo11/)
 * (@massdoo11)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14346798)
 * Image of my theme-functions.php : [https://pasteboard.co/JYme9OV.png](https://pasteboard.co/JYme9OV.png)
 *  Plugin Contributor [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * (@yordansoares)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14348704)
 * Hello [@massdoo11](https://wordpress.org/support/users/massdoo11/),
 * I can’t see the screenshots you sent. Could you re-upload the images using imgur.
   com?
 *  Thread Starter [massdoo11](https://wordpress.org/support/users/massdoo11/)
 * (@massdoo11)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14349939)
 * Hello,
 * Image of my theme-functions.php : [https://imgur.com/YsWJeeE](https://imgur.com/YsWJeeE)
 * I just inserted your code in the theme-functions of my email.
 * But the date is not displayed… [https://imgur.com/y276Vjn](https://imgur.com/y276Vjn)
 * Thanks You
 *  Plugin Contributor [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * (@yordansoares)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14351585)
 * Hello [@massdoo11](https://wordpress.org/support/users/massdoo11/),
 * I used the `membership_expiry_date` meta key as an example, but you need to change
   it to your actual meta key (if the case).
 * But, as I said before, I sent you that example before to completely understand
   your case.
 * I think you need something like this:
 *     ```
       add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_delivery_date', 10, 2 );
       function wpo_wcpdf_delivery_date ($template_type, $order) {    
           if ($template_type == 'invoice') {
            $order_date = $order->order_date;    
            $membership_expiry_date = date_i18n( get_option( 'date_format' ), strtotime( $order_date . ' + 1 year') );
               ?>
               <tr class="membership-notice">
                   <th>Membership valid until:</th>
                   <td><?php echo $membership_expiry_date; ?></td>
               </tr>
               <?php
           }
       }
       ```
   
 * Let me know if it works!
 * Kind regards.
 *  Thread Starter [massdoo11](https://wordpress.org/support/users/massdoo11/)
 * (@massdoo11)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14352575)
 * I am testing
    -  This reply was modified 5 years, 1 month ago by [massdoo11](https://wordpress.org/support/users/massdoo11/).
 *  Thread Starter [massdoo11](https://wordpress.org/support/users/massdoo11/)
 * (@massdoo11)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14363778)
 * Hello
 * Thanks a lot, it works perfectly!
 * Have a nice day
 *  Plugin Contributor [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * (@yordansoares)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14365401)
 * Hello [@massdoo11](https://wordpress.org/support/users/massdoo11/),
 * I’m glad to know it worked!
 * If you don’t mind and have the time, do you think you could [leave us a review](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/#new-post)?
 * Thanks in advance and all the best with your store!

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Order date + 1 year’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-packing-slips/assets/icon-256x256.
   png?rev=2189942)
 * [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/order-date-1-year/#post-14365401)
 * Status: resolved