Ọkọ rẹ

Kẹkẹkẹ rẹ ti ṣofo lọwọlọwọ.

Tesiwaju lilọ kiri ayelujara -1) { //TODO: Update Quantity // $.get('/cart/change?id=' +defaultCustomVariantId +'&quantity=0', function() {}); continue; } } if (!totalPrice || totalPrice == 0 || totalPrice == '0') { continue; } $.ajax({ type: 'POST', url: '/cart/add.js', data: { id: defaultCustomVariantId, quantity: totalPrice * productQuantity, properties: { '__custom_item_rand_id': randItemId, '__custom_item_price': randItemPrice, } }, dataType: 'json', success: function () { if (isRedirect) { window.location.href = "/cart"; } }, error: function(XMLHttpRequest, textStatus, errorThrown) {} }); } return false; } function updateVariantInCart(variantId, quantity, isRedirect) { $.ajax({ type: 'GET', url: '/cart/change?id=' +variantId +'&quantity=' +quantity, success: function () { if (isRedirect) { window.location.href = "/cart"; } }, error: function(XMLHttpRequest, textStatus, errorThrown) {} }); return true; } function removeCustomItem(items, addedCustomItems, defaultCustomVariantId, isRedirect) { if (!addedCustomItems.length) { return false; } var removeAllCusItem = true; for(var i = 0; i < items.length; i++) { var variantId = items[i]['variant_id']; if (variantId != defaultCustomVariantId) { removeAllCusItem = false; break; } } if (removeAllCusItem) { // $.get('/cart/change?id=' +defaultCustomVariantId +'&quantity=0', function() {}); updateVariantInCart(defaultCustomVariantId, 0, isRedirect); return true; } for(var ci = 0; ci < addedCustomItems.length; ci++) { var hasBasedProduct = false; for(var i = 0; i < items.length; i++) { var variantId = items[i]['variant_id']; if (variantId == defaultCustomVariantId) { continue; } if (items[i]['properties'] == "undefined") { continue; } if (items[i]['properties']['__custom_item_rand_id'] == "undefined") { continue; } var randItemId = items[i]['properties']['__custom_item_rand_id']; if (addedCustomItems[ci] == randItemId) { hasBasedProduct = true; break; } } if (!hasBasedProduct) { //TODO: line item index // $.get('/cart/change?id=' +defaultCustomVariantId +'&quantity=0', function() {}); updateVariantInCart(defaultCustomVariantId, 0, isRedirect); return true; } } return false; } function updateCustomItem(items, addedCustomItems, defaultCustomVariantId, isRedirect) { for(var i = 0; i < items.length; i++) { var variantId = items[i]['variant_id']; if (variantId == defaultCustomVariantId) { continue; } if (items[i]['properties'] == "undefined") { continue; } if (items[i]['properties']['__custom_item_rand_id'] == "undefined" || items[i]['properties']['__custom_item_price'] == "undefined") { continue; } var randItemId = items[i]['properties']['__custom_item_rand_id']; var totalPrice = items[i]['properties']['__custom_item_price']; if (!randItemId) { continue; } if (addedCustomItems.length) { if (addedCustomItems.indexOf(randItemId) == -1) { continue; } } totalPrice = totalPrice * items[i]['quantity']; //TODO: line item index // $.get('/cart/change?id=' +defaultCustomVariantId +'&quantity=' +totalPrice, function() {}); updateVariantInCart(defaultCustomVariantId, totalPrice, isRedirect); return true; } return false; } function addRemoveTrigger(defaultCustomVariantId, isRedirect) { $.ajax({ type: 'GET', url: '/cart.js', dataType: 'json', success: function (data) { var items = data['items']; var addedCustomItems = getCustomItems(items, defaultCustomVariantId); addCustomItem(items, addedCustomItems, defaultCustomVariantId, isRedirect); removeCustomItem(items, addedCustomItems, defaultCustomVariantId, isRedirect); } }); } function updateTrigger(defaultCustomVariantId, isRedirect) { $.ajax({ type: 'GET', url: '/cart.js', dataType: 'json', success: function (data) { var items = data['items']; var addedCustomItems = getCustomItems(items, defaultCustomVariantId); var flagUpdate = updateCustomItem(items, addedCustomItems, defaultCustomVariantId, isRedirect); if (flagUpdate && isRedirect) { setTimeout(function(){ window.location.href = "/cart"; }, 450); } } }); } function hideCustomItemInCart(propertiesSearchKey, productVariantSearchKey, productSearchKey) { //Hide properties var hasCustomItem = false; $('span, dt').each(function () { if ($(this).html()) { if ($(this).html().search(propertiesSearchKey) > -1) { $(this).parent().fadeOut(0); $(this).fadeOut(0); hasCustomItem = true; } } }); $('li').each(function () { if ($(this).html()) { if ($(this).html().search(propertiesSearchKey) > -1) { $(this).fadeOut(0); hasCustomItem = true; } } }); $('a').each(function () { if ($(this).attr('href')) { if ($(this).attr('href').search(productVariantSearchKey) > -1) { try { if ($(this).parents('tr')) $(this).parents('tr').fadeOut(0); if ($(this).parents('.cart__row')) $(this).parents('.cart__row').fadeOut(0); if ($(this).parents('.cart-row')) $(this).parents('.cart-row').fadeOut(0); if ($(this).parents('.cart-table-row')) $(this).parents('.cart-table-row').fadeOut(0); } catch(err) { console.log(err.message); } hasCustomItem = true; } } if ($(this).html()) { if ($(this).html().search(productSearchKey) > -1) { try { if ($(this).parents('tr')) $(this).parents('tr').fadeOut(0); if ($(this).parents('.cart__row')) $(this).parents('.cart__row').fadeOut(0); if ($(this).parents('.cart-row')) $(this).parents('.cart-row').fadeOut(0); } catch(err) { console.log(err.message); } hasCustomItem = true; } } }); return hasCustomItem; } $(document).ready(function () { $('input[type="submit"]').prop('disabled', 'disabled'); setTimeout(function () { $('input[type="submit"]').removeAttr('disabled'); }, 2000); var defaultCustomVariantId = '37195360632993'; var propertiesSearchKey = '__custom_item_'; var productSearchKey = '__Customized-Items'; var productVariantSearchKey = 'variant=37195360632993'; if (!defaultCustomVariantId) { return false; } //TODO: some theme does not display hidden properties __xxx ==> this function return false; var hasCustomItem = hideCustomItemInCart(propertiesSearchKey, productVariantSearchKey, productSearchKey); if (!hasCustomItem) { // return false; } addRemoveTrigger(defaultCustomVariantId, true); //TODO: if only has custom items in cart ==> clear cart $('a').click(function () { setTimeout(function () { addRemoveTrigger(defaultCustomVariantId, false); setTimeout(function () { hideCustomItemInCart(propertiesSearchKey, productVariantSearchKey, productSearchKey); }, 485); }, 300); }); $('input').change(function () { setTimeout(function () { updateTrigger(defaultCustomVariantId, false); setTimeout(function () { hideCustomItemInCart(propertiesSearchKey, productVariantSearchKey, productSearchKey); }, 485); }, 1200); }); }); }; if (typeof jQuery == "undefined") { var script = document.createElement("SCRIPT"); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; script.type = 'text/javascript'; document.getElementsByTagName("head")[0].appendChild(script); checkReady(function($) { runCode($); }); } else { runCode(jQuery); } }, 250); })();

Net Orders Checkout

Item Price Qty Total
Subtotal $0.00
Shipping
Total

Shipping Address

Shipping Methods

Trustpilot