Advertisement
rijarob

change product option value in cart

Jul 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. {% if context == 'cart' or context == 'checkout' or context == 'receipt' %}
  2. <script>
  3. FC.client.on('render.done', function() {
  4. for (i = 0; i < FC.json.items.length; i++) {
  5. var item_id = FC.json.items[i].id;
  6. var base = parseFloat(FC.json.items[i].base_price);
  7. var each = parseFloat(FC.json.items[i].price_each);
  8. var quantity = FC.json.items[i].quantity;
  9. var dollar_discount = parseFloat((base - each) * quantity);
  10. // In this case, discountapplied is the discount name, change to match your settings
  11. $(".fc-cart__item__remove [data-fc-item-id='" + item_id + "']").parents(".fc-cart__item__options").find('.fc-cart__item__option__discountapplied .fc-cart__item__option__value').text(jQuery.trim(FC.util.money_format(FC.json.config.currency_format, dollar_discount)));
  12. }
  13. });
  14. </script>
  15. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement