All things Shopify and commerce
When trying to remove items from the cart on my site it gives an error code "no valid id or line parameters". If you refresh the page and try again it works fine. It doesn't always do it either which is super confusing.
I have this same issue except i am on a different theme, shrine pro elite ecom. Ive noticed at least in my case this occurs when there is more than one item in the cart whether its 3 of my main product or my main product plus a free gift. Devs had responded to me with some code however it did not work for me but maybe it will work for your theme
Here is what i was provided:
// Fix for "no valid id or line paramters" error in Shrine Pro Elite Ecom theme // Add this code to your theme.js file or in a custom JavaScript file document.addEventListener('DOMContentLoaded', function() { // Target all cart item remove buttons const removeButtons = document.querySelectorAll('.cart__remove-btn, .cart-item__remove, [data-cart-remove]'); if (removeButtons.length > 0) { removeButtons.forEach(button => { button.addEventListener('click', function(e) { e.preventDefault(); // Get the line item ID from various possible attributes let lineId = this.getAttribute('data-line-id') || this.getAttribute('data-line') || this.getAttribute('data-cart-item-key') || this.closest('[data-line-item]')?.getAttribute('data-line-item'); // If we still don't have a line ID, try to get it from the URL if (!lineId && this.href) { const url = new URL(this.href); lineId = url.searchParams.get('id') || url.searchParams.get('line'); } // If we have a valid line ID, remove the item if (lineId) { removeCartItem(lineId); } else { console.error('Could not find line ID for cart item removal'); } }); }); } // Function to remove item from cart using Fetch API function removeCartItem(lineId) { fetch('/cart/change.js', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify({ id: lineId, quantity: 0 }) }) .then(response => response.json()) .then(cart => { // Refresh the cart display if (typeof refreshCart === 'function') { refreshCart(cart); } else { // If no refreshCart function exists, reload the page window.location.reload(); } }) .catch(error => { console.error('Error removing item from cart:', error); // Fallback - redirect to cart page window.location.href = '/cart'; }); } // Optional: Function to refresh cart if your theme supports it function refreshCart(cart) { // Update cart count const cartCountElements = document.querySelectorAll('.cart-count, .cart-count-bubble, [data-cart-count]'); cartCountElements.forEach(el => { el.textContent = cart.item_count; if (cart.item_count === 0) { el.classList.add('hide'); } else { el.classList.remove('hide'); } }); // If using drawer cart, open it to show updated cart const cartDrawerElement = document.querySelector('#CartDrawer, .cart-drawer, [data-drawer-cart]'); if (cartDrawerElement && typeof openCartDrawer === 'function') { openCartDrawer(); } // If on cart page, reload to show updated cart if (window.location.pathname.includes('/cart')) { window.location.reload(); } } });
This solution addresses multiple potential causes of your issue:
Interesting.
You have an app (Pickeasy) which adds line item property "_instoreAppId": "FT=NA" to the items added to cart. This happens on the cart page.
When line item properties change, the unique ID of the item in cart changes.
Because cart page was rendered before this line item property was added, the links on your cart page become invalid and this is why your "-", "+" and "Remove" buttons no longer work until you refresh the page.
You should talk to the App developers about this.
Basically, when one wants to manipulate item in cart Shopify API allows you to use one of the following IDs:
1) line number
2) variant id
3) line item id (same as variant id, but has extra number derived from line item properties)
Methods 1 and 2 are not affected by changes in line item properties, but method 3 is.
Different themes may use different methods. Most of them, though (including yours) use method 3, which seems to be incompatible with the Pickeasy app.
Some App reviews mention this problem.
This appears to be correct. Reaching out to pickeasy now
Let us know what they say/do
They got in our system and poked around. Then sent this which did in fact fix it.
Hi,
Thank you for your patience.
We are pleased to inform you that our technical team has successfully implemented the updatePropertyOnCheckout feature. This update ensures that property alterations will only take place when the checkout action is triggered.
Please take a moment to verify this update on your end. Should you encounter any issues or require further assistance, don’t hesitate to reach out. We are more than happy to help!
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025