All things Shopify and commerce
Hello! I've been trying to find a way to get rid of a "NaN" value that keeps showing in the cart popover when you add a product to cart. From my theme.js file it looks like the cart popover should be showing the "Quantity" followed by the "Product Title" but what renders is "NaN Product Title":
I inspected my site to see where the line of code comes from, and what I see is that the NaN is in the <h3> tag within the product title and no quantity is displayed:
I'm unsure what happened but my site is so heavily customized that I can not reach out to my theme developers for help. Any insight on why the quantity isn't displaying or how I can simply remove the "NaN" would be so appreciated!
Below is the details section of the cart popover from my theme.js file:
showCartNotificationPopup: function(product){ var addedQuantity = parseInt( $('.quantity__input', this.$container).val() ); var title = product.product_title.length > 20 ? product.product_title.substring(0, 20) + '...' : product.product_title; var variant = product.variant_title == 'Default Title' ? false : product.variant_title; var image = slate.Image.getSizedImageUrl(product.image, '720x720'); var unitPrice = this.$container.find('[data-product-unit]')[0] || null; if (unitPrice) { unitPrice = unitPrice.outerHTML; } var itemData = { item_count: addedQuantity, product_image: image, product_title: title, variant: variant, price: product.price, unit_price: unitPrice, price_formatted: slate.Currency.formatMoney(product.price, theme.moneyFormat) }
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024