{"id":5890,"date":"2022-05-07T14:07:04","date_gmt":"2022-05-07T18:07:04","guid":{"rendered":"https:\/\/themespress.ca\/?p=5890"},"modified":"2022-05-11T06:09:01","modified_gmt":"2022-05-11T10:09:01","slug":"adding-metadata-latest-update-woocommerce-product","status":"publish","type":"post","link":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/","title":{"rendered":"Adding Metadata (latest update) &#8211; WooCommerce Product"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products.<\/p>\n<p>Our data would allow us to diplay the date <span class=\"corrected-phrase ng-star-inserted\" data-end=\"218\" data-originaltext=\"que \" data-start=\"215\" data-text=\"o\u00f9\"><span class=\"corrected-phrase__displayed-text corrected-phrase__displayed-text_bubbled\" data-group=\"AutoCorrected\" data-suggestions=\"1\" data-type=\"Grammar\">where<\/span><\/span> the number of days where the updates were done.<\/p>\n<p>So let&#8217;s say you&#8217;re selling downloadable products. You want your customers to see the last date <span class=\"phrase-bubble__suggestion-label ng-tns-c88-3 phrase-bubble__suggestion-label_active phrase-bubble__suggestion-label_only-one ng-star-inserted\"><span class=\"ng-tns-c88-3 ng-star-inserted\">when<\/span><\/span> the product was updated.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading\" >Creating a class for a WordPress metabox<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>As you&#8217;ll notice, our metabox has a date field by default.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-5238323\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-5238323\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">\/\/ Meta Box Class: Woocommerce Product Update\nclass woocommerceproductupMetabox {\n\n\tprivate $screen = array(\n\t\t&#039;product&#039;,\n\t);\n\n\tprivate $meta_fields = array(\n\t\tarray(\n\t\t\t&#039;label&#039; =&gt; &#039;Recent updates for this product ?&#039;,\n\t\t\t&#039;id&#039; =&gt; &#039;woocommerce-update-product&#039;,\n\t\t\t&#039;default&#039; =&gt; &#039;Aujourdhui&#039;,\n\t\t\t&#039;type&#039; =&gt; &#039;date&#039;,\n\t\t),\n\t);\n\n\tpublic function __construct() {\n\t\tadd_action( &#039;add_meta_boxes&#039;, array( $this, &#039;add_meta_boxes&#039; ) );\n\t\tadd_action( &#039;save_post&#039;, array( $this, &#039;save_fields&#039; ) );\n\t}\n\n\tpublic function add_meta_boxes() {\n\t\tforeach ( $this-&gt;screen as $single_screen ) {\n\t\t\tadd_meta_box(\n\t\t\t\t&#039;woocommerceproductup&#039;,\n\t\t\t\t__( &#039;Woocommerce Product Update&#039;, &#039;textdomain&#039; ),\n\t\t\t\tarray( $this, &#039;meta_box_callback&#039; ),\n\t\t\t\t$single_screen,\n\t\t\t\t&#039;normal&#039;,\n\t\t\t\t&#039;high&#039;\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic function meta_box_callback( $post ) {\n\t\twp_nonce_field( &#039;woocommerceproductup_data&#039;, &#039;woocommerceproductup_nonce&#039; );\n\t\t$this-&gt;field_generator( $post );\n\t}\n\n\tpublic function field_generator( $post ) {\n\t\t$output = &#039;&#039;;\n\t\tforeach ( $this-&gt;meta_fields as $meta_field ) {\n\t\t\t$label = &#039;&lt;label for=&quot;&#039; . $meta_field[&#039;id&#039;] . &#039;&quot;&gt;&#039; . $meta_field[&#039;label&#039;] . &#039;&lt;\/label&gt;&#039;;\n\t\t\t$meta_value = get_post_meta( $post-&gt;ID, $meta_field[&#039;id&#039;], true );\n\t\t\tif ( empty( $meta_value ) ) {\n\t\t\t\tif ( isset( $meta_field[&#039;default&#039;] ) ) {\n\t\t\t\t\t$meta_value = $meta_field[&#039;default&#039;];\n\t\t\t\t}\n\t\t\t}\n\t\t\tswitch ( $meta_field[&#039;type&#039;] ) {\n\t\t\t\tdefault:\n\t\t\t\t\t$input = sprintf(\n\t\t\t\t\t\t&#039;&lt;input %s id=&quot;%s&quot; name=&quot;%s&quot; type=&quot;%s&quot; value=&quot;%s&quot;&gt;&#039;,\n\t\t\t\t\t\t$meta_field[&#039;type&#039;] !== &#039;color&#039; ? &#039;style=&quot;width: 100%&quot;&#039; : &#039;&#039;,\n\t\t\t\t\t\t$meta_field[&#039;id&#039;],\n\t\t\t\t\t\t$meta_field[&#039;id&#039;],\n\t\t\t\t\t\t$meta_field[&#039;type&#039;],\n\t\t\t\t\t\t$meta_value\n\t\t\t\t\t);\n\t\t\t}\n\t\t\t$output .= $this-&gt;format_rows( $label, $input );\n\t\t}\n\t\techo &#039;&lt;table class=&quot;form-table&quot;&gt;&lt;tbody&gt;&#039; . $output . &#039;&lt;\/tbody&gt;&lt;\/table&gt;&#039;;\n\t}\n\n\tpublic function format_rows( $label, $input ) {\n\t\treturn &#039;&lt;tr&gt;&lt;th&gt;&#039;.$label.&#039;&lt;\/th&gt;&lt;td&gt;&#039;.$input.&#039;&lt;\/td&gt;&lt;\/tr&gt;&#039;;\n\t}\n\n\tpublic function save_fields( $post_id ) {\n\t\tif ( ! isset( $_POST[&#039;woocommerceproductup_nonce&#039;] ) )\n\t\t\treturn $post_id;\n\t\t$nonce = $_POST[&#039;woocommerceproductup_nonce&#039;];\n\t\tif ( !wp_verify_nonce( $nonce, &#039;woocommerceproductup_data&#039; ) )\n\t\t\treturn $post_id;\n\t\tif ( defined( &#039;DOING_AUTOSAVE&#039; ) &amp;&amp; DOING_AUTOSAVE )\n\t\t\treturn $post_id;\n\t\tforeach ( $this-&gt;meta_fields as $meta_field ) {\n\t\t\tif ( isset( $_POST[ $meta_field[&#039;id&#039;] ] ) ) {\n\t\t\t\tswitch ( $meta_field[&#039;type&#039;] ) {\n\t\t\t\t\tcase &#039;email&#039;:\n\t\t\t\t\t\t$_POST[ $meta_field[&#039;id&#039;] ] = sanitize_email( $_POST[ $meta_field[&#039;id&#039;] ] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase &#039;text&#039;:\n\t\t\t\t\t\t$_POST[ $meta_field[&#039;id&#039;] ] = sanitize_text_field( $_POST[ $meta_field[&#039;id&#039;] ] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tupdate_post_meta( $post_id, $meta_field[&#039;id&#039;], $_POST[ $meta_field[&#039;id&#039;] ] );\n\t\t\t} else if ( $meta_field[&#039;type&#039;] === &#039;checkbox&#039; ) {\n\t\t\t\tupdate_post_meta( $post_id, $meta_field[&#039;id&#039;], &#039;0&#039; );\n\t\t\t}\n\t\t}\n\t}\n}\n\nif (class_exists(&#039;woocommerceproductupMetabox&#039;)) {\n\tnew woocommerceproductupMetabox;\n};\n<\/pre><\/div><h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading\" >Visual of our WooCommerce product metabox<\/h2>\n\t<div  class=\"wpb_single_image wpb_content_element vc_align_left wpb_content_element\">\n\t\t\n\t\t<figure class=\"wpb_wrapper vc_figure\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Metabox-pour-vos-produits-WooCommerce-1024x144.png\" target=\"_self\" class=\"vc_single_image-wrapper   vc_box_border_grey\"><img decoding=\"async\" width=\"1402\" height=\"197\" src=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Metabox-pour-vos-produits-WooCommerce.png\" class=\"vc_single_image-img attachment-full\" alt=\"Metabox pour vos produits WooCommerce\" title=\"Metabox pour vos produits WooCommerce\" srcset=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Metabox-pour-vos-produits-WooCommerce.png 1402w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Metabox-pour-vos-produits-WooCommerce-600x84.png 600w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Metabox-pour-vos-produits-WooCommerce-300x42.png 300w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Metabox-pour-vos-produits-WooCommerce-1024x144.png 1024w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Metabox-pour-vos-produits-WooCommerce-768x108.png 768w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Metabox-pour-vos-produits-WooCommerce-1320x185.png 1320w\" sizes=\"(max-width: 1402px) 100vw, 1402px\" \/><\/a>\n\t\t<\/figure>\n\t<\/div>\n<h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading\" >Adding the update date in the loop of our product<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>Donc nous allons utiliser le hook <a href=\"http:\/\/hookr.io\/actions\/woocommerce_before_shop_loop_item_title\/\" target=\"_blank\" rel=\"noopener\"><strong>woocommerce_before_shop_loop_item_title<\/strong><\/a><\/p>\n<p>This hook will allow us to position our <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_post_meta\/\" target=\"_blank\" rel=\"noopener\"><strong>get_post_meta<\/strong><\/a> of the <strong>de woocommerce-update-product<\/strong> name before the product&#8217;s title inside the loop, i.e. in product pages&#8217; results.<\/p>\n<p>We can also customize the date. With this hook, we will display the date however we see fit.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-2731068\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-2731068\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">add_action( &#039;woocommerce_before_shop_loop_item_title&#039;, &#039;themespress_field_display_below_title&#039;, 2 );\nfunction themespress_field_display_below_title(){\n    global $product;\n    \/\/ Get the custom field value\n    $custom_field = get_post_meta( $product-&gt;get_id(), &#039;woocommerce-update-product&#039;, true );\n    \/\/ Display\n    if( ! empty($custom_field) ){\n        echo &#039;&lt;p class=&quot;last-updates&quot; style=&quot;position:absolute;top:30px;background:#f95b26;color:white;padding:2px 5px&quot;&gt;&#039; . &#039;MAJ : &#039; . (new DateTime($custom_field))-&gt;format(&#039;d M Y&#039;) . &#039;&lt;\/p&gt;&#039;;\n    }\n}<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>Or we can edit the hook so we can display the n number of days since the last update of the WooCommerce product.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-4255879\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-4255879\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">add_action( &#039;woocommerce_before_shop_loop_item_title&#039;, &#039;themespressdeux_field_display_below_title&#039;, 2 );\nfunction themespressdeux_field_display_below_title(){\n    global $product;\n    \/\/ Get the custom field value\n    $custom_field = get_post_meta( $product-&gt;get_id(), &#039;woocommerce-update-product&#039;, true );\n    \/\/ Display\n\t$now = time(); \/\/ Current time \n\t$your_date = strtotime($custom_field); \/\/ The first date\n\t$datediff = abs($now - $your_date); \/\/ Gives absolute Value\n    if( ! empty($custom_field) ){ \n\t\techo &#039;&lt;p class=&quot;last-updates&quot; style=&quot;position:absolute;top:30px;background:#f95b26;color:white;padding:2px 5px&quot;&gt;&#039; . &#039;MAJ : &#039; . floor($datediff\/(60*60*24)) . &#039;&amp;nbsp;jour(s)&#039; . &#039;&lt;\/p&gt;&#039;;\n    }\n}<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p><strong>We strongly advise against copying it twice. Choose the first or second example.<\/strong><\/p>\n\n\t\t<\/div>\n\t<\/div>\n<h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading\" >Display the get_post_meta in the WooCommerce product<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>All that&#8217;s left to do now is use the <a href=\"http:\/\/hookr.io\/actions\/woocommerce_before_single_product_summary\/\" target=\"_blank\" rel=\"noopener\">woocommerce_before_single_product_summary<\/a> hook in order to display the information about the product.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-6541385\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-6541385\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">add_action( &#039;woocommerce_before_single_product_summary&#039; , &#039;themespress_updates_date_before_product_title&#039;, 5 );\nfunction themespress_updates_date_before_product_title() {\n    global $product;\n    \/\/ Get the custom field value\n    $custom_field = get_post_meta( $product-&gt;get_id(), &#039;woocommerce-update-product&#039;, true );\n    \/\/ Display\n\t$now = time(); \/\/ Current time \n\t$your_date = strtotime($custom_field); \/\/ The first date\n\t$datediff = abs($now - $your_date); \/\/ Gives absolute Value\n    if( ! empty($custom_field) ){ \n\t\techo &#039;&lt;p class=&quot;last-updates&quot; style=&quot;position:absolute;top:-40px;right:0;background:#f95b26;color:white;padding:2px 5px&quot;&gt;&#039; . &#039;MAJ : &#039; . floor($datediff\/(60*60*24)) . &#039;&amp;nbsp;jour(s)&#039; . &#039;&lt;\/p&gt;&#039;;\n    }\n}<\/pre><\/div><\/div><\/div><\/div><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products. Our data would allow us to diplay the date where the number of days where<div class=\"read-more\"><a class=\"btn button-secondary\" href=\"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/\">Read More<\/a><\/div>","protected":false},"author":81,"featured_media":5891,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[283],"tags":[328],"class_list":["post-5890","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-woocommerce-config"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Share the post &quot;Adding Metadata (latest update) \u2013 WooCommerce Product&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products. Our data would allow us to diplay the date where the number of days where the updates were done. So let\u2019s\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Daniel\"\/>\n\t<meta name=\"google-site-verification\" content=\"t6BGEKVeq0mBMvotb-TgZMJCdlDLuU-VkrnMjlExL5M\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Themespress - Des tutoriels et ressources WordPress\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Adding Metadata (latest update) \u2013 WooCommerce Product - Themespress\" \/>\n\t\t<meta property=\"og:description\" content=\"Share the post &quot;Adding Metadata (latest update) \u2013 WooCommerce Product&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products. Our data would allow us to diplay the date where the number of days where the updates were done. So let\u2019s\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2022-05-07T18:07:04-04:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-05-11T10:09:01-04:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Adding Metadata (latest update) \u2013 WooCommerce Product - Themespress\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Share the post &quot;Adding Metadata (latest update) \u2013 WooCommerce Product&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products. Our data would allow us to diplay the date where the number of days where the updates were done. So let\u2019s\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#blogposting\",\"name\":\"Adding Metadata (latest update) \\u2013 WooCommerce Product - Themespress\",\"headline\":\"Adding Metadata (latest update) &#8211; WooCommerce Product\",\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Adding-Metadata-latest-update-WooCommerce-Product.jpg\",\"width\":2560,\"height\":1707},\"datePublished\":\"2022-05-07T14:07:04-04:00\",\"dateModified\":\"2022-05-11T06:09:01-04:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#webpage\"},\"articleSection\":\"Tutorials, WooCommerce\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#listItem\",\"name\":\"Adding Metadata (latest update) &#8211; WooCommerce Product\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"name\":\"Accueil\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#listItem\",\"position\":3,\"name\":\"Adding Metadata (latest update) &#8211; WooCommerce Product\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/\",\"name\":\"Daniel\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Daniel\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#webpage\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/\",\"name\":\"Adding Metadata (latest update) \\u2013 WooCommerce Product - Themespress\",\"description\":\"Share the post \\\"Adding Metadata (latest update) \\u2013 WooCommerce Product\\\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products. Our data would allow us to diplay the date where the number of days where the updates were done. So let\\u2019s\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Adding-Metadata-latest-update-WooCommerce-Product.jpg\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#mainImage\",\"width\":2560,\"height\":1707},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/adding-metadata-latest-update-woocommerce-product\\\/#mainImage\"},\"datePublished\":\"2022-05-07T14:07:04-04:00\",\"dateModified\":\"2022-05-11T06:09:01-04:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Adding Metadata (latest update) \u2013 WooCommerce Product - Themespress","description":"Share the post \"Adding Metadata (latest update) \u2013 WooCommerce Product\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products. Our data would allow us to diplay the date where the number of days where the updates were done. So let\u2019s","canonical_url":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"t6BGEKVeq0mBMvotb-TgZMJCdlDLuU-VkrnMjlExL5M","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#blogposting","name":"Adding Metadata (latest update) \u2013 WooCommerce Product - Themespress","headline":"Adding Metadata (latest update) &#8211; WooCommerce Product","author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Adding-Metadata-latest-update-WooCommerce-Product.jpg","width":2560,"height":1707},"datePublished":"2022-05-07T14:07:04-04:00","dateModified":"2022-05-11T06:09:01-04:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#webpage"},"isPartOf":{"@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#webpage"},"articleSection":"Tutorials, WooCommerce"},{"@type":"BreadcrumbList","@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","position":1,"name":"Accueil","item":"https:\/\/themespress.ca\/en\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","position":2,"name":"Tutorials","item":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#listItem","name":"Adding Metadata (latest update) &#8211; WooCommerce Product"},"previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","name":"Accueil"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#listItem","position":3,"name":"Adding Metadata (latest update) &#8211; WooCommerce Product","previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}}]},{"@type":"Organization","@id":"https:\/\/themespress.ca\/en\/#organization","name":"Themespress","description":"Des tutoriels et ressources WordPress","url":"https:\/\/themespress.ca\/en\/"},{"@type":"Person","@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author","url":"https:\/\/themespress.ca\/en\/author\/daniel\/","name":"Daniel","image":{"@type":"ImageObject","@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g","width":96,"height":96,"caption":"Daniel"}},{"@type":"WebPage","@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#webpage","url":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/","name":"Adding Metadata (latest update) \u2013 WooCommerce Product - Themespress","description":"Share the post \"Adding Metadata (latest update) \u2013 WooCommerce Product\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products. Our data would allow us to diplay the date where the number of days where the updates were done. So let\u2019s","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/themespress.ca\/en\/#website"},"breadcrumb":{"@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#breadcrumblist"},"author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"creator":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/05\/Adding-Metadata-latest-update-WooCommerce-Product.jpg","@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#mainImage","width":2560,"height":1707},"primaryImageOfPage":{"@id":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/#mainImage"},"datePublished":"2022-05-07T14:07:04-04:00","dateModified":"2022-05-11T06:09:01-04:00"},{"@type":"WebSite","@id":"https:\/\/themespress.ca\/en\/#website","url":"https:\/\/themespress.ca\/en\/","name":"Themespress","description":"Des tutoriels et ressources WordPress","inLanguage":"en-US","publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"}}]},"og:locale":"en_US","og:site_name":"Themespress - Des tutoriels et ressources WordPress","og:type":"article","og:title":"Adding Metadata (latest update) \u2013 WooCommerce Product - Themespress","og:description":"Share the post &quot;Adding Metadata (latest update) \u2013 WooCommerce Product&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products. Our data would allow us to diplay the date where the number of days where the updates were done. So let\u2019s","og:url":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/","article:published_time":"2022-05-07T18:07:04-04:00","article:modified_time":"2022-05-11T10:09:01-04:00","twitter:card":"summary","twitter:title":"Adding Metadata (latest update) \u2013 WooCommerce Product - Themespress","twitter:description":"Share the post &quot;Adding Metadata (latest update) \u2013 WooCommerce Product&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a new WordPress metabox for our downloadable WooCommerce products. Our data would allow us to diplay the date where the number of days where the updates were done. So let\u2019s"},"aioseo_meta_data":{"post_id":"5890","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"Article","defaultPostTypeGraph":""},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2022-05-11 09:51:04","updated":"2025-06-08 01:12:05","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/\" title=\"Accueil\">Accueil<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/categorie\/tutorials\/\" title=\"Tutorials\">Tutorials<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tAdding Metadata (latest update) \u2013 WooCommerce Product\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Accueil","link":"https:\/\/themespress.ca\/en\/"},{"label":"Tutorials","link":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/"},{"label":"Adding Metadata (latest update) &#8211; WooCommerce Product","link":"https:\/\/themespress.ca\/en\/adding-metadata-latest-update-woocommerce-product\/"}],"_links":{"self":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/5890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/comments?post=5890"}],"version-history":[{"count":0,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/5890\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media\/5891"}],"wp:attachment":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media?parent=5890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/categories?post=5890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/tags?post=5890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}