Skip to content

Product Shipping Time

Use product_shipping_time module to insert a shipping time of the currently viewed product on a page. This module is available only within a product card.

Configuration parameters

none

Module source code

{% from "@macros/icon.twig" import icon %}

{% set product = ObjectApi.getProduct(product_id) %}
{% set shopUrls = ObjectApi.getShopUrls() %}

{% if product.delivery is not null or product.delivery is null and product.options.count > 0 %}
    <product-shipping-time
        class="product-shipping-time property"
        {% if product.delivery is null %}hidden{% endif %}
        product-id="{{ product.id }}"
    >
        {{
            icon('icon-clock', {
                classNames: ['mr-xs-1']
            })
        }}

        <span class="property__key color_main">{{ translate('Shipping time') }}:</span>
        <span class="product-shipping-time__time property__value" data-shipping-time>{{ product.delivery.name }}</span>
    </product-shipping-time>

    <script type="application/ld+json">
    {
        "@context": [
            "http://schema.org/",
            { "@base": "{{ shopUrls.mainPageUrl.absolute }}" }
        ],
        "@id": "{{ product.url.relative }}",
        "offers": {
            "@id": "{{ product.url.relative }}",
            "@type": "Offer",
            "shippingDetails": {
                "@type": "OfferShippingDetails",
                "deliveryTime": {
                    "@type": "ShippingDeliveryTime",
                    "transitTime": {
                        "@type": "QuantitativeValue",
                        "minValue": "{{ product.delivery.duration.days }}",
                        "maxValue": "{{ product.delivery.duration.days }}"
                    }
                }
            }
        }
    }
    </script>
{% endif %}

The module uses JSON-LD and Microdata from schema.org to optimize search results in browsers.

Webcomponents reference

Used Object Api methods

Used styles

Module configuration schema

[
    {
        "state": "unfolded",
        "label": "General settings",
        "elements": [
            {
                "type": "infobox",
                "name": "infobox",
                "options": {
                    "type": "blank",
                    "message": "#### Related settings in the admin panel%s- changing phrases in [translations](%s)%s- [shipping time settings](%s)",
                    "placeholderValues": [
                        "\n",
                        "\/admin\/configLanguages\/list",
                        "\n",
                        "\/admin\/configDeliveries\/list"
                    ]
                }
            }
        ]
    }
]