The initial source comes from sdcuike/issueBlog#4
https://github.com/PacktPublishing free to download books code by Packet
https://github.com/EbookFoundation/free-programming-books Very immense
| $(document).on('click', '#finish-customization', function(e){ | |
| e.preventDefault(); | |
| bundle_prefix = "{{ product.handle | replace: '-','_' }}"; | |
| bundle_id = Math.floor((Math.random() * 100000) + 1); | |
| $('input[name="properties[Custom Product ID]"]').val(bundle_prefix+'_'+bundle_id); | |
| $(this).find('span').html('Adding to Cart'); | |
| var $result = decodeURIComponent($('#AddToCartForm-{{ section.id }}').serialize()); | |
| $result = $result.split('&'); |
| // Display motivator message | |
| ShopifyAPI.saleMotivator = function(cart, cart_motivator_goal, motivator_msg_selector) { | |
| var cart_subtotal = parseFloat(cart.total_price / 100).toFixed(2); | |
| var cart_motivator_goal = cart_motivator_goal; | |
| var cart_motivator_goal_remaining = parseFloat(cart_motivator_goal - cart_subtotal).toFixed(2); | |
| var motivator_msg = motivator_msg_selector; | |
| if (cart_subtotal == 0) { | |
| motivator_msg.html('FREE SHIPPING ON ORDERS OVER $' + cart_motivator_goal); | |
| } else { | |
| if (cart_subtotal >= cart_motivator_goal) { |
| 1. add snippet to cart.liquid file at the bottom of the file | |
| {% include 'upsell-modal' %} | |
| 2. add css to theme.liquid in the header | |
| {{ 'upsell-modal.scss' | asset_url | stylesheet_tag }} |
| {% assign current_product_handle = product.handle %} | |
| {% assign upsell_product_col = 'col-xs-4' %} | |
| {% assign sum = product.price %} | |
| {% assign number_of_upsell_products = 0 %} | |
| {% for upsell_product in upsell_collection.products limit: 4 %} | |
| {% unless upsell_product.handle == current_product_handle %} | |
| {% assign sum = sum | plus: upsell_product.price %} | |
| {% endunless %} | |
| {% assign number_of_upsell_products = forloop.index %} | |
| {% endfor %} |
https://github.com/PacktPublishing free to download books code by Packet
https://github.com/EbookFoundation/free-programming-books Very immense
| /* ---------------------------------------------------------- */ | |
| /* */ | |
| /* A media query that captures: */ | |
| /* */ | |
| /* - Retina iOS devices */ | |
| /* - Retina Macs running Safari */ | |
| /* - High DPI Windows PCs running IE 8 and above */ | |
| /* - Low DPI Windows PCs running IE, zoomed in */ | |
| /* - Low DPI Windows PCs and Macs running Firefox, zoomed in */ | |
| /* - Android hdpi devices and above */ |