card drawer show amount for free delivery
parent
cda684caa8
commit
9a4cf4c264
|
@ -82,7 +82,7 @@
|
|||
{% endif %}
|
||||
|
||||
<script>
|
||||
console.log("cart26", {{ cart | json }}, {{ remaining_amount }}, {{ free_shipping_threshold }}, {{ progress_percentage }}, {{ total_price }}, {{ free_shipping_threshold }}, {{ total_price | times: 100 | divided_by: free_shipping_threshold }})
|
||||
console.log("cart27", {{ cart | json }}, {{ remaining_amount }}, {{ free_shipping_threshold }}, {{ progress_percentage }}, {{ total_price }}, {{ free_shipping_threshold }}, {{ total_price | times: 100 | divided_by: free_shipping_threshold }})
|
||||
</script>
|
||||
|
||||
<div style="padding: 12px 12px 0 12px; background-color: #deecde; text-align: center;">
|
||||
|
@ -114,10 +114,15 @@
|
|||
|
||||
// Listen for custom event to update progress bar
|
||||
document.addEventListener("cart:updated", function(event) {
|
||||
console.log("event cart:updated", event)
|
||||
|
||||
const newTotalPrice = event.detail.total_price;
|
||||
const newFreeShippingThreshold = {{ free_shipping_threshold }};
|
||||
let newProgressPercentage = (newTotalPrice * 100) / newFreeShippingThreshold;
|
||||
if (newProgressPercentage > 100) newProgressPercentage = 100;
|
||||
|
||||
console.log("newProgressPercentage", newProgressPercentage)
|
||||
|
||||
updateProgressBar(newProgressPercentage);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue