{"id":10502,"date":"2022-01-24T13:30:53","date_gmt":"2022-01-24T12:30:53","guid":{"rendered":"https:\/\/www.welaunch.io\/en\/?post_type=faq&#038;p=10502"},"modified":"2022-01-24T13:30:53","modified_gmt":"2022-01-24T12:30:53","slug":"how-to-display-delivery-data-in-custom-templates-email","status":"publish","type":"faq","link":"https:\/\/www.welaunch.io\/en\/knowledge-base\/faq\/how-to-display-delivery-data-in-custom-templates-email\/","title":{"rendered":"How to Display Delivery Data in Custom Templates \/ Email"},"content":{"rendered":"<p>If you want to show the delivery date, time or location in a custom template or Email in WooCommerce you have to options. First, you simply go into your template file and add a code to get the meta and output it like this:<\/p>\n<pre>$deliveryDate = get_post_meta($orderID, 'delivery_date', true);\r\necho $deliveryDate;<\/pre>\n<p>Second would be to add the code below into your functions.php of your child theme. Then you can use the following shortcode in any page builder for example:<\/p>\n<pre>And here it is in shortcode form to be added to the functions.php file: \r\n\/\/ function that runs when shortcode is called\r\nfunction ddoutput_shortcode($atts) {\r\n \r\n$orderId = $atts['orderid']:\r\n\/\/ Things that you want to do.\r\n $deliveryDate = get_post_meta($orderId, 'delivery_date',true);\r\n\r\n\/\/ Output needs to be return\r\necho $deliveryDate;\r\n}\r\n\/\/ register shortcode\r\nadd_shortcode('deliverydate', 'ddoutput_shortcode');\r\n<\/pre>\n<p>When using the shortcode make sure you add the orderid parameter.<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","product_cat":[],"class_list":["post-10502","faq","type-faq","status-publish","hentry","faq_topics-delivery","faq_topics-delivery-filter-hooks"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/10502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=10502"}],"version-history":[{"count":1,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/10502\/revisions"}],"predecessor-version":[{"id":10503,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/10502\/revisions\/10503"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=10502"}],"wp:term":[{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/product_cat?post=10502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}