card drawer show amount for free delivery

main
alexanderroese 2024-06-19 09:37:00 +02:00
parent cda684caa8
commit 9a4cf4c264
1 changed files with 6 additions and 1 deletions

View File

@ -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);
});
});