Skip to content

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

relocate JS

Jon Lawrencebcbd33edfe30
diff --git a/saleor/static/js/components/cart.js b/saleor/static/js/components/cart.js
index 70583987be..76d6957be5 100644
--- a/saleor/static/js/components/cart.js
+++ b/saleor/static/js/components/cart.js
@@ -1,6 +1,6 @@
import {getAjaxError} from './misc';
-export const summaryLink = '/cart/summary/';
+export var summaryLink = '/cart/summary/'; /* overriden in base.html to url 'cart:cart-summary' */
export const $cartDropdown = $('.cart-dropdown');
export const $cartIcon = $('.cart__icon');
export const $addToCartError = $('.product__info__form-error small');
@@ -28,7 +28,7 @@ export const onAddToCartSuccess = () => {
export default $(document).ready((e) => {
// Cart dropdown
-
+ summaryLink = cartURL; // override from base.html
$.get(summaryLink, (data) => {
$cartDropdown.html(data);
});
@@ -133,7 +133,7 @@ export default $(document).ready((e) => {
let deliveryAjax = (e) => {
let newCountry = $(countrySelect).val();
$.ajax({
- url: '/cart/shipingoptions/',
+ url: shippingOptionsURL, // this is set in base.html to cart:shipping-options
type: 'POST',
data: {
'csrfmiddlewaretoken': crsfToken,
diff --git a/templates/base.html b/templates/base.html
index 78eb4c849e..eecd0195a1 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -266,6 +266,10 @@
{% endblock %}
{% block footer_scripts %}
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
+ <script type="text/javascript">
+ var cartURL = "{% url 'cart:cart-summary'%}";
+ var shippingOptionsURL = "{% url 'cart:shipping-options' %}";
+ </script>
{% render_bundle 'vendor' 'js' %}
{% render_bundle 'storefront' 'js' %}
{% endblock footer_scripts %}