Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Move delivery calculation to cart table

Mira Szewczykbba677b18b6e
diff --git a/saleor/static/scss/components/_forms.scss b/saleor/static/scss/components/_forms.scss
index efd8d55610..d30ccf9b9c 100644
--- a/saleor/static/scss/components/_forms.scss
+++ b/saleor/static/scss/components/_forms.scss
@@ -36,11 +36,9 @@
@include media-breakpoint-down(sm) {
width: 100%;
}
+ max-width: 100%;
background-color: $white;
height: calc(2.25rem + 2px);
- @include media-breakpoint-up(sm) {
- float: right;
- }
&:focus {
outline: none;
}
diff --git a/templates/cart/index.html b/templates/cart/index.html
index e75796a8fb..a470c58e21 100644
--- a/templates/cart/index.html
+++ b/templates/cart/index.html
@@ -4,6 +4,7 @@
{% load staticfiles %}
{% load render_bundle from webpack_loader %}
{% load get_thumbnail from product_images %}
+{% load price_range from price_ranges %}
{% block title %}{% trans "Your cart" context "Cart page title" %} — {{ block.super }}{% endblock %}
@@ -69,6 +70,30 @@
</div>
{% endfor %}
<div class="cart__total">
+ {% if shipping_required %}
+ <div class="row">
+ <div class="col-7 cart__total__subtotal">
+ <h3><small>{% trans "Shipping cost for:" context "Cart secondary title" %}</small></h3>
+ <br>
+ </div>
+ <div class="col-5">
+ <div class="row">
+ <div class="col-md-7 col-12 deliveryform">
+ <div class="deliveryform" data-csrf="{{ csrf_token }}">
+ {{ country_form.country }}
+ </div>
+ </div>
+ <div class="cart-item-subtotal col-md-5 col-12">
+ <h3 class="text-right cart__delivery-info__price">
+ {% if default_country_options %}
+ {% price_range default_country_options %}
+ {% endif %}
+ </h3>
+ </div>
+ </div>
+ </div>
+ </div>
+ {% endif %}
<div class="row">
<div class="col-8 cart__total__subtotal">
<h3>{% trans "Subtotal" context "Order subtotal" %}</h3>
@@ -92,7 +117,6 @@
</div>
</div>
</div>
- {% if shipping_required %}
<div class="row">
<div class="col-md-12">
<a href="{% url "checkout:login" %}" class="btn primary float-md-right">
@@ -100,27 +124,6 @@
</a>
</div>
</div>
- <div class="cart__delivery-info">
- <h3><small>{% trans "Calculate shipping cost" context "Cart secondary title" %}</small></h3>
- <div class="col-md-8 col-lg-6 col-xl-5">
- <div class="cart__delivery-info__list row">
- <div class="deliveryform" data-csrf="{{ csrf_token }}">
- {{ country_form }}
- </div>
- <div class="col-6 cart__delivery-info__method">
- {% for option in default_country_options %}
- <p>{{ option.shipping_method__name }}</p>
- {% endfor %}
- </div>
- <div class="col-6 cart__delivery-info__price">
- {% for option in default_country_options %}
- <p class="text-right">{% gross option.price html=True %}</p>
- {% endfor %}
- </div>
- </div>
- </div>
- </div>
- {% endif %}
{% else %}
<div class="cart__empty">
<img src="{% static 'images/pirate_cart.png' %}"