{"id":94,"date":"2020-02-28T15:59:07","date_gmt":"2020-02-28T15:59:07","guid":{"rendered":"http:\/\/wiki2.plumserver.com\/knowledge-base\/magento-2-estimated-delivery-date-v2-x-developers-guide-and-api-reference"},"modified":"2021-09-24T04:19:06","modified_gmt":"2021-09-24T08:19:06","slug":"magento-2-estimated-delivery-date-v2-x-developers-guide-and-api-reference","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide","title":{"rendered":"Magento 2 Estimated Delivery Date v2.x Developer Guide and API Reference"},"content":{"rendered":"\n<h2 id=\"magento-2-estimated-delivery-date-manual-configuration\">Magento 2 Estimated Delivery Date Manual Configuration<\/h2>\n\n\n\n<p>The <a href=\"\/magento-estimated-delivery-date\">Estimated Delivery Date module<\/a> will automatically add &#8220;Delivery Dates&#8221; on the Product Page if enabled in the backend. However, you can change the standard &#8220;Delivery Date&#8221; display or position in the front-end. To do this follow the instructions below.<\/p>\n\n\n\n<h3>Product Page<\/h3>\n\n\n\n<p>In order to have the Delivery Date displayed on the product page &#8211; please make the following steps on your server&nbsp;:1. Create file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\/app\/design\/frontend\/&lt;Vendor>\/&lt;theme>\/Plumrocket_Estimateddelivery\/layout\/catalog_product_view.xml<\/code><\/pre><\/div>\n\n\n\n<p>2. Paste the code below into the created file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">&lt;?xml version=\"1.0\"?>\n&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n    xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n    &lt;body>\n        &lt;move element=\"estimateddelivery_product\" destination=\"CONTAINER_OR_BLOCK_NAME\"\n            after=\"-\"\/>\n    &lt;\/body>\n&lt;\/page><\/code><\/pre><\/div>\n\n\n\n<p><i>CONTAINER_OR_BLOCK_NAME &#8211; name of one of the containers or blocks on the product page. You can check them in the theme layout.<\/i><\/p>\n\n\n\n<p><i>Go to:<\/i><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\/app\/design\/frontend\/&lt;Vendor>\/&lt;theme>\/Magento_Catalog\/layout\/catalog_product_view.xml<\/code><\/pre><\/div>\n\n\n\n<p><i>or:<\/i><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\/vendor\/magento\/module-catalog\/view\/frontend\/layout\/catalog_product_view.xml<\/code><\/pre><\/div>\n\n\n\n<p><i>after=&#8221;-&#8221; means that block with estimated delivery dates has been placed into container.<\/i>CONTAINER_OR_BLOCK_NAME after all the blocks. before=&#8221;-&#8221; can be used, if you need to place it before other blocks. Instead of &#8220;-&#8221; you can use name of specific block, if you need to place estimated delivery dates before or after it.<\/p>\n\n\n<div class=\"example-block\">\n<p class=\"example-block-title\">Example:<\/p>\n<div class=\"wp-block-prismatic-blocks\">\n<div><\/div>\n<pre><code class=\"language-markup\">&lt;?xml version=\"1.0\"?&gt;\n    &lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n        xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\"&gt;\n        &lt;body&gt;\n            &lt;move element=\"estimateddelivery_product\" destination=\"product.info.extrahint\"\n                after=\"-\"\/&gt;\n        &lt;\/body&gt;\n    &lt;\/page&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n<h3>Category Page<\/h3>\n\n\n\n<p>In order to add the Estimated Delivery dates to the products on the category page, make the following steps on your server:<\/p>\n\n\n\n<p>1. Create file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\/app\/design\/frontend\/&lt;Vendor>\/&lt;theme>\/Plumrocket_Estimateddelivery\/layout\/catalog_category_view.xml<\/code><\/pre><\/div>\n\n\n\n<p>2. Paste the code below into the created file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\/app\/design\/frontend\/&lt;Vendor>\/&lt;theme>\/Magento_Catalog\/layout\/catalog_product_view.xml<\/code><\/pre><\/div>\n\n\n\n<p><i>or here:<\/i><\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\/vendor\/magento\/module-catalog\/view\/frontend\/layout\/catalog_product_view.xml<\/code><\/pre><\/div>\n\n\n\n<h2 id=\"display-estimated-delivery-dates-and-shipping-dates-in-magento-for-specific-categories-products\">Display Estimated Delivery Dates and Shipping Dates in Magento for Specific Categories &amp; Products<\/h2>\n\n\n\n<p>The following methods in &#8220;Plumrocket_Estimateddelivery_Block_Product&#8221; block allow to show shipping and delivery dates for specific products:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">setProduct($product)<\/code><\/pre><\/div>\n\n\n\n<p>Allows to set the product the dates will be shown for.<\/p>\n\n\n<div class=\"example-block\">\n<p class=\"example-block-title\">Example:<\/p>\n<p><strong>Let&#8217;s show the date for &#8220;related&#8221; products on Product Page:<\/strong><\/p>\n<div class=\"wp-block-prismatic-blocks\">\n<div><\/div>\n<pre><code class=\"language-php\">$relatedProducts = get_related_products(); \/\/ where get_related_products() is some custom\n        method to retrieve related products\n    $estimatedBlock = $this-&gt;getLayout()-&gt;createBlock(\n        \"PlumrocketEstimateddeliveryBlockProduct\")\n        -&gt;setTemplate(\"Plumrocket_Estimateddelivery::product.phtml\");\n    foreach ($relatedProducts as $_product) {\n        echo $estimatedBlock-&gt;setProduct($_product)-&gt;toHtml();\n    }<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"example-block\">\n<p class=\"example-block-title\">Example:<\/p>\n<p>On <strong>Product Page with custom design<\/strong> we can display dates for &#8220;related&#8221; products and immediately after that display dates for the current product:<\/p>\n<div class=\"wp-block-prismatic-blocks\">\n<div><\/div>\n<pre><code class=\"language-php\">&lt;div class=\"related_dates\"&gt;\n        &lt;?php\n            $relatedProducts = get_related_products(); \/\/ where get_related_products() is\n                some custom method to retrieve related products\n            foreach ($relatedProducts as $_product) {\n                echo $this-&gt;getChild('estimateddelivery')-&gt;setProduct($_product)-&gt;toHtml();\n            }\n        ?&gt;\n    &lt;\/div&gt;\n    \n    &lt;div class=\"main_date\"&gt;\n        &lt;?php $this-&gt;getChild('estimateddelivery')-&gt;reset()-&gt;toHtml(); ?&gt;\n    &lt;\/div&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">setCategory($category)<\/code><\/pre><\/div>\n\n\n\n<p>Allows to set the category for which the dates will be shown.<\/p>\n\n\n<div class=\"example-block\">\n<p class=\"example-block-title\">Example:<\/p>\n<p><strong>Let&#8217;s display html block that contains delivery date for the set category:<\/strong><\/p>\n<div class=\"wp-block-prismatic-blocks\">\n<div><\/div>\n<pre><code class=\"language-php\">$customCategory = MagentoFrameworkAppObjectManager::getInstance()-&gt;create(\n        'MagentoCatalogModelCategory')-&gt;load(&lt;any id&gt;);\n    echo $this-&gt;getLayout()\n        -&gt;createBlock('PlumrocketEstimateddeliveryBlockProduct')\n        -&gt;setTemplate('Plumrocket_Estimateddelivery::product.phtml')\n        -&gt;setCategory($customCategory)\n        -&gt;toHtml();<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">getProduct()<\/code><\/pre><\/div>\n\n\n\n<p>Allows to get the product for which the dates will be shown. Note: If no product was indicated manually &#8211; current product will be returned on Product Page.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">getCategory()<\/code><\/pre><\/div>\n\n\n\n<p>Allows to get the category the dates will be shown for. Note: If no category was indicated manually &#8211; current category will be returned on Product Page or Category Page.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-php\">reset()<\/code><\/pre><\/div>\n\n\n\n<p>Allows to clear all current settings. After calling this method, the other methods (getProduct and getCategory) will return current product (on Product Page) and current category (on Product Page or Category Page) accordingly.This method comes handy for displaying dates of custom products (categories) on the product (category) page, and for returning to default settings.<\/p>\n\n\n<div class=\"example-block\">\n<p class=\"example-block-title\">Example code of <em>layout.xml<\/em> file:<\/p>\n<p><strong>Let&#8217;s display block with date for the product by inserting it into the layout:<\/strong><\/p>\n<div class=\"wp-block-prismatic-blocks\">\n<div><\/div>\n<pre><code class=\"language-markup\">&lt;catalog_product_default&gt;\n        &lt;body&gt;\n            &lt;referenceContainer name=\"category.view.container\"&gt;\n                &lt;block class=\"PlumrocketEstimateddeliveryBlockProduct\"\n                    name=\"estimateddelivery_product\" as=\"estimateddelivery\"\n                    template=\"Plumrocket_Estimateddelivery::product.phtml\" cacheable=\"false\" \/&gt;\n            &lt;\/referenceContainer&gt;\n        &lt;\/body&gt;<\/code><\/pre>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Magento 2 Estimated Delivery Date Manual Configuration The Estimated Delivery Date module will automatically add &#8220;Delivery Dates&#8221; on the Product Page if enabled in the backend. However, you can change the standard &#8220;Delivery Date&#8221; display or position in the front-end. To do this follow the instructions below. Product Page In order to have the Delivery &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Magento 2 Estimated Delivery Date v2.x Developer Guide and API Reference&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[151],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v17.2 (Yoast SEO v17.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Magento 2 Estimated Delivery Date v2.x Developer Guide and API Reference - Plumrocket Documentation<\/title>\n<meta name=\"description\" content=\"Magento 2 Estimated Delivery Date Manual Configuration The Estimated Delivery Date module will automatically add &quot;Delivery Dates&quot; on the Product Page if\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magento 2 Estimated Delivery Date v2.x Developer Guide and API Reference\" \/>\n<meta property=\"og:description\" content=\"Magento 2 Estimated Delivery Date Manual Configuration The Estimated Delivery Date module will automatically add &quot;Delivery Dates&quot; on the Product Page if\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide\" \/>\n<meta property=\"og:site_name\" content=\"Plumrocket Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-28T15:59:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-24T08:19:06+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Plumrocket\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Magento 2 Estimated Delivery Date v2.x Developer Guide and API Reference - Plumrocket Documentation","description":"Magento 2 Estimated Delivery Date Manual Configuration The Estimated Delivery Date module will automatically add \"Delivery Dates\" on the Product Page if","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide","og_locale":"en_US","og_type":"article","og_title":"Magento 2 Estimated Delivery Date v2.x Developer Guide and API Reference","og_description":"Magento 2 Estimated Delivery Date Manual Configuration The Estimated Delivery Date module will automatically add \"Delivery Dates\" on the Product Page if","og_url":"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide","og_site_name":"Plumrocket Documentation","article_published_time":"2020-02-28T15:59:07+00:00","article_modified_time":"2021-09-24T08:19:06+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Plumrocket","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/plumrocket.com\/docs\/#website","url":"https:\/\/plumrocket.com\/docs\/","name":"Plumrocket Documentation","description":"Extensions docs, troubleshootings etc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/plumrocket.com\/docs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide#webpage","url":"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide","name":"Magento 2 Estimated Delivery Date v2.x Developer Guide and API Reference - Plumrocket Documentation","isPartOf":{"@id":"https:\/\/plumrocket.com\/docs\/#website"},"datePublished":"2020-02-28T15:59:07+00:00","dateModified":"2021-09-24T08:19:06+00:00","author":{"@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/38b360639b934d6c984ee4f3ffce7d20"},"description":"Magento 2 Estimated Delivery Date Manual Configuration The Estimated Delivery Date module will automatically add \"Delivery Dates\" on the Product Page if","breadcrumb":{"@id":"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2\/devguide#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Magento 2 Extensions","item":"https:\/\/plumrocket.com\/magento-extensions"},{"@type":"ListItem","position":2,"name":"Magento 2 Estimated Delivery Date","item":"https:\/\/plumrocket.com\/magento-estimated-delivery-date"},{"@type":"ListItem","position":3,"name":"Documentation","item":"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date"},{"@type":"ListItem","position":4,"name":"v2","item":"https:\/\/plumrocket.com\/docs\/magento-estimated-delivery-date\/v2"},{"@type":"ListItem","position":5,"name":"Developer Guide"}]},{"@type":"Person","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/38b360639b934d6c984ee4f3ffce7d20","name":"Plumrocket","image":{"@type":"ImageObject","@id":"https:\/\/plumrocket.com\/docs\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/72392a92ae750c66560be284502b6676?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/72392a92ae750c66560be284502b6676?s=96&d=mm&r=g","caption":"Plumrocket"},"sameAs":["https:\/\/plumrocket.com\/docs"]}]}},"_links":{"self":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/94"}],"collection":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/comments?post=94"}],"version-history":[{"count":4,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":24368,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/94\/revisions\/24368"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}