Created
November 22, 2016 16:03
-
-
Save geetfun/7cd724c69c6a999df388b6ea0b8ea51f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Checkend Recurring Billing --> | |
{% assign row_loop_index = forloop.index %} | |
{% for p in item.properties %} | |
{% if p.first == "Subscription" %} | |
<script> | |
$.getJSON('https://subscriptionorder.com/product_lookup/{{ item.product.id }}/variants/{{ item.variant.id }}', function(response) { | |
var discountPercentage = response.discount_percentage; | |
var discount = Number(discountPercentage) / 100; | |
var unitPrice = $("#checkend-cart-row-{{row_loop_index}}").find("[data-checkend-unit-price]").data("checkend-unit-price"); | |
var discountUnitPrice = (unitPrice * (1-discount)); | |
console.log(unitPrice); | |
$("#checkend-cart-row-{{row_loop_index}}").find("[data-checkend-unit-price]").html("$ "+(discountUnitPrice/100).toFixed(2)); | |
var quantity = $("#checkend-cart-row-{{row_loop_index}}").find("[data-checkend-quantity]").data("checkend-quantity"); | |
$("#checkend-cart-row-{{row_loop_index}}").find("[data-checkend-total-price]").html("$ "+(discountUnitPrice*quantity/100).toFixed(2)); | |
}); | |
window.subscriptionOrderApp = true; | |
</script> | |
{% endif %} | |
{% endfor %} | |
<!-- Checkend Recurring Billing --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment