← back to Dw Theme Boost Fix

templates/customers/order.liquid

263 lines

<div class="customer-section">
  <h1 class="page-title">{{ 'customers.order.header' | t: order_number: order.name }}</h1>

  {% render 'breadcrumbs' %}

  <div class="customer-wrapper">

    <div class="shipping-info">
      <div class="customer-address shipping-address">
        <h2 class="section-title">{{ 'customers.order.shipping_address' | t }}</h2>
        <p>
          <span>{{ order.shipping_address.first_name }} {{ order.shipping_address.last_name }}</span><br>
          {% if order.shipping_address.company != blank %}
            <span>{{ order.shipping_address.company }}</span><br>
          {% endif %}
          {% if order.shipping_address.street != blank %}
            <span>{{ order.shipping_address.street }}</span><br>
          {% endif %}
          {% if order.shipping_address.city != blank or order.shipping_address.province_code != blank %}
            <span>{{ order.shipping_address.city }}{% if order.shipping_address.province_code %}, {{ order.shipping_address.province_code }}{% endif %}</span><br>
          {% endif %}
          {% if order.shipping_address.country != blank or order.shipping_address.zip != blank %}
            <span>{{ order.shipping_address.country }} {{ order.shipping_address.zip }}</span><br>
          {% endif %}
          {% if order.shipping_address.phone != blank %}
            <span>{{ order.shipping_address.phone }}</span><br>
          {% endif %}
        </p>
      </div>

      <div class="customer-address shipping-address">
        <h2 class="section-title">{{ 'customers.order.billing_address' | t }}</h2>
        <p>
          <span>{{ order.billing_address.first_name }} {{ order.billing_address.last_name }}</span><br>
          {% if order.billing_address.company != blank %}
            <span>{{ order.billing_address.company }}</span><br>
          {% endif %}
          {% if order.billing_address.street != blank %}
            <span>{{ order.billing_address.street }}</span><br>
          {% endif %}
          {% if order.billing_address.city != blank or order.billing_address.province_code != blank %}
            <span>{{ order.billing_address.city }}{% if order.billing_address.province_code %}, {{ order.billing_address.province_code }}{% endif %}</span><br>
          {% endif %}
          {% if order.billing_address.country != blank or order.billing_address.zip != blank %}
            <span>{{ order.billing_address.country }} {{ order.billing_address.zip }}</span><br>
          {% endif %}
          {% if order.billing_address.phone != blank %}
            <span>{{ order.billing_address.phone }}</span><br>
          {% endif %}
        </p>
      </div>
    </div>

    <div class="order-history">

      <table class="order">
        <thead>
          <tr>
            <th class="first">{{ 'general.general.product' | t }}</th>
            <th>{{ 'general.general.price' | t }}</th>
            <th>{{ 'general.general.quantity' | t }}</th>
            <th class="last">{{ 'general.general.total' | t }}</th>
          </tr>
        </thead>

        <tbody>
          {% for line_item in order.line_items %}
            {%- assign item_has_discounts = false -%}
            {%- if line_item.line_level_discount_allocations.size > 0 -%}
              {%- assign item_has_discounts = true -%}
            {%- endif -%}
            <tr class="{% render 'for-looper', forloop: forloop %} {% if order.cancelled %}cancelled_order{% endif %}">
              <td class="order-product-item first">
                <a class="order-image" href="{{ line_item.product.url }}">
                  {%
                    render 'rimg',
                    img: line_item.product,
                    alt: line_item.title,
                    size: '100x100'
                  %}
                </a>
                <div class="order-details">
                  <span class="order-vendor">{{ line_item.vendor }}</span>
                  <span class="order-title">{{ line_item.title | link_to: line_item.product.url }}</span>
                  {% if line_item.variant.title != 'Default Title' %}
                    <span class="order-variant">{{ line_item.variant.title }}</span>
                  {% endif %}
                  {% if line_item.selling_plan_allocation.selling_plan %}
                    <span class="order-subscriptions">{{ line_item.selling_plan_allocation.selling_plan.name }}</span>
                  {% endif %}
                  {%- if item_has_discounts -%}
                    <ul class="cart-item-discounts">
                      {% for discount_allocation in line_item.line_level_discount_allocations %}
                        <li class="cart-item-discount">
                          {% render 'icons', id: 'sale-tag' %}
                          {{ discount_allocation.discount_application.title }}
                          (-<span class="money">{{ discount_allocation.amount | money }}</span>)
                        </li>
                      {% endfor %}
                    </ul>
                  {%- endif -%}
                </div>
              </td>
              <td class="order-price" data-title="{{ 'general.general.price' | t }}">
                {% assign variant_for_unit_price = line_item %}
                {%- if item_has_discounts -%}
                  <span class="order-discount-container">
                    <s class="original-price">
                      <span class="money">{{ line_item.original_price | money }}</span>
                    </s>
                    <span class="final-price money">{{ line_item.final_price | money }}</span>
                    {% if line_item.unit_price %}
                      {% comment %}Inject unit-price begin{% endcomment %}
                      {% comment %}
                        @param variant_for_unit_price
                          Product variant for price
                        @param tax_text
                          String containing 'tax included' text
                      {% endcomment %}
                      
                      {% capture total_quantity %}
                        <span class="product-price__unit-price-total-quantity" data-unit-price-quantity>
                          {{ variant_for_unit_price.unit_price_measurement.quantity_value }}{{ variant_for_unit_price.unit_price_measurement.quantity_unit }}
                        </span>
                      {% endcapture %}
                      
                      
                      {% capture unit_price %}
                        <span class="product-price__unit-price-amount money" data-unit-price-amount>
                          {{ variant_for_unit_price.unit_price | money }}
                        </span>
                      {% endcapture %}
                      {% capture unit_measure %}
                        <span class="product-price__unit-price-measure" data-unit-price-measure>
                          {%- if variant_for_unit_price.unit_price_measurement.reference_value != 1 -%}
                            {{ variant_for_unit_price.unit_price_measurement.reference_value }}
                          {%- endif %}
                          {{ variant_for_unit_price.unit_price_measurement.reference_unit }}
                        </span>
                      {% endcapture %}
                      
                      <div
                        class="
                          product-price__unit-price
                          {% unless variant_for_unit_price.unit_price_measurement %}hidden{% endunless %}
                        "
                        data-unit-price
                      >
                        {{ 'products.product.price_per_unit_html' | t: total_quantity: total_quantity, unit_price: unit_price, unit_measure: unit_measure | strip_newlines }}
                      </div>
                      
                      {% assign variant_for_unit_price = blank %}
                      {% comment %}Inject unit-price end{% endcomment %}

                    {% endif %}

                  </span>
                {% else %}
                  <div class="final-price-container">
                    <span class="final-price money">{{ line_item.final_price | money }}</span>
                    {% if line_item.unit_price %}
                      {% comment %}Inject unit-price begin{% endcomment %}
                      {% comment %}
                        @param variant_for_unit_price
                          Product variant for price
                        @param tax_text
                          String containing 'tax included' text
                      {% endcomment %}
                      
                      {% capture total_quantity %}
                        <span class="product-price__unit-price-total-quantity" data-unit-price-quantity>
                          {{ variant_for_unit_price.unit_price_measurement.quantity_value }}{{ variant_for_unit_price.unit_price_measurement.quantity_unit }}
                        </span>
                      {% endcapture %}
                      
                      
                      {% capture unit_price %}
                        <span class="product-price__unit-price-amount money" data-unit-price-amount>
                          {{ variant_for_unit_price.unit_price | money }}
                        </span>
                      {% endcapture %}
                      {% capture unit_measure %}
                        <span class="product-price__unit-price-measure" data-unit-price-measure>
                          {%- if variant_for_unit_price.unit_price_measurement.reference_value != 1 -%}
                            {{ variant_for_unit_price.unit_price_measurement.reference_value }}
                          {%- endif %}
                          {{ variant_for_unit_price.unit_price_measurement.reference_unit }}
                        </span>
                      {% endcapture %}
                      
                      <div
                        class="
                          product-price__unit-price
                          {% unless variant_for_unit_price.unit_price_measurement %}hidden{% endunless %}
                        "
                        data-unit-price
                      >
                        {{ 'products.product.price_per_unit_html' | t: total_quantity: total_quantity, unit_price: unit_price, unit_measure: unit_measure | strip_newlines }}
                      </div>
                      
                      {% assign variant_for_unit_price = blank %}
                      {% comment %}Inject unit-price end{% endcomment %}

                    {% endif %}
                  </div>
                {%- endif -%}
              </td>
              <td class="order-quantity" data-title="{{ 'general.general.quantity' | t }}"><span>{{ line_item.quantity }}</span></td>
              <td class="order-total last" data-title="{{ 'general.general.total' | t }}">
                {% if item_has_discounts %}
                  <span class="order-discount-container">
                    <s class="original-price">
                      <span class="money">{{ line_item.original_line_price | money }}</span>
                    </s>
                    <span class="final-price money">{{ line_item.final_line_price | money }}</span>
                  </span>
                {% else %}
                  <span class="money final-price">{{ line_item.final_line_price | money }}</span>
                {% endif %}
              </td>
            </tr>
          {% endfor %}
        </tbody>
      </table>

      <table class="order-totals">
        <tr>
          <td>{{ 'general.general.subtotal' | t }}</td>
          <td><span class="money">{{ order.line_items_subtotal_price | money }}</span></td>
        </tr>
        {%- for discount_application in order.cart_level_discount_applications -%}
          <tr>
            <td>
              <span class="order-discount-title">
                {% render 'icons', id: 'sale-tag' %}
                {{- discount_application.title | strip -}}
              </span>
            </td>
            <td>
              <span class="order-discount-price">-<span class="money">{{ discount_application.total_allocated_amount | money }}</span></span>
            </td>
          </tr>
        {%- endfor -%}
        <tr>
          {% for shipping_method in order.shipping_methods %}
            <td>{{ 'customers.order.shipping' | t }} ({{ shipping_method.title }})</td>
            <td><span class="money">{{ shipping_method.price | money }}</span></td>
          {% endfor %}
        </tr>
          {% for tax_line in order.tax_lines %}
            <tr>
              <td>{{ 'customers.order.tax' | t }} ({{ tax_line.title }} {{ tax_line.rate | times: 100 }}%)</td>
              <td><span class="money">{{ tax_line.price | money }}</span></td>
            </tr>
          {% endfor %}
        <tr>
          <td>{{ 'general.general.total' | t }}</td>
          <td><span class="money">{{ order.total_price | money }}</span></td>
        </tr>
      </table>
    </div>
  </div>
</div>