Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- goes in checkout template -->
- <!-- have to remove config.supports_purchase_order on testing because can only enable with live -->
- <!-- put config.supports_purchase_order in {% if payment_info_required and po_coupon %} when live -->
- {% block payment_method %}
- {% set po_coupon = false %}
- {% if coupons.NOCC %}
- {% set po_coupon = true %}
- {% endif %}
- {% if payment_info_required and po_coupon %}
- {% set config = config|merge({ supports_pay_with_plastic: false, supports_purchase_order: true}) %}
- {% set payment_method_type = "purchase_order" %}
- {% else %}
- {% set config = config|merge({ supports_pay_with_plastic: true, supports_purchase_order: false}) %}
- {% endif %}
- {{ parent() }}
- {% endblock %}
- <!-- If I add it while in the checkout, it changes the cc to po -->
- <!-- If I remove it in the checkout, then readd it, I have to refresh the page -->
- <!-- template footer -->
- <!-- if coupon is removed from cart, cc fields appear, if coupon added back, this script doesn't execute -->
- {% if context == "checkout" and coupons.NOCC %}
- <script>
- FC.client.on("ready.done", checkPO);
- FC.client.on("cart-item-remove.done", checkPO);
- FC.client.on("cart-item-quantity-update.done", checkPO);
- FC.client.on("cart-coupon-add.done", checkPO);
- FC.client.on("customer-login.done", checkPO);
- function checkPO(customer_po) {
- var customer_po = $("#customer_email").val();
- console.log(customer_po);
- $("#fc-payment-method-purchase-order").hide();
- $("#fc-icon-lock-large").hide();
- $("#fc-payment-method-purchase-order").after("<div class=col-md-2></div><b>No payment method required</b>");
- $("#purchase_order").val(customer_po);
- FC.cart.render();
- }
- </script>
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement