All Questions
67
questions
0
votes
2
answers
99
views
Add new items to cart in session if not found, otherwise increase quantity
I have some code that can add an item to a cart as well as update its quantity if it gets re-added. It also is able to add other items to the cart, but the problem is that when any item that isn't the ...
1
vote
2
answers
368
views
JavaScript: delete product from cart with minus button
I'm trying to eliminate the product added to the cart using the "-" button when the quantity reaches 1 unit. I hope someone can help me, I've been looking for a solution for two days. Thanks ...
0
votes
1
answer
267
views
how do i map over items in an input feild?
I am making a form that sends over the shipping details of a user . I am however finding it difficult to map over the shipping other in an input field that is immutable(read only). I keep getting this ...
-1
votes
1
answer
8k
views
How can I calculate the total price of products in a cart using JavaScript?
I'm stuck on how to calculate the total amount and total price of my cart in this project.
The task is to create a simple (beginners) e-commerce website where a customer should be able to click on a ...
1
vote
1
answer
46
views
Cart array $_SESSION['cart'] not prininting cart items properly
I am doing shopping cart functionality on an ecommerce site via $_SESSION.
I added cart items successfully on every click in $_SESSION['cart'] array. but unable to print it correctly.
I made an ...
0
votes
1
answer
386
views
How to display all object in array from local storage jquery
I made an array of objects holding data of cart items, Now after adding Items I want to display all data of items in shopping cart.
How can It be displayed ?
I dont know how to access properties in ...
0
votes
2
answers
906
views
How do I change my mutation to accept an array of IDs instead of a single ID?
I have a cart for anonymous users and would like to pass the cart into the database with a mutation. I've created a test but can't pass multiple values all at once. I end up with an error like…
[...
0
votes
1
answer
45
views
creating session array in my shopping cart not functioning
hello I am trying to create a simple shopping cart for my school project the problem I have was the session array is not creating and array with information. So I can't add items on my cart. here is ...
1
vote
1
answer
479
views
I want to loop through my array and calculate my values-JavaScript
I want to able to loop my arrays and calculate the total price and display it in the console.
this is suppose to be a cart application. I assign all the anchor tags to cart variable that loops through ...
-1
votes
1
answer
651
views
Add item to cart if size property is different but the ID keys are the same
I created a cart push insert items into it, the logic is this:
I have an array:
`let cartItems = [];`
To contain Product objects with defined properties:
{
"id": 10,
"name": "...
2
votes
1
answer
1k
views
Woocommerce: Get some custom cart item data value from a plugin
I am trying to get a specific value from from a product in the cart.
I need this value as a multiplier for setting a price in a specific category, I have most of this working, except I am having ...
0
votes
0
answers
192
views
Expected null to deeply equal [Array (1)]
just a brief question. I've been struggling to figure out what this error in javascript actually means: "Timed out retrying: expected null to deeply equal [Array (1)]
I'm basically working on a ...
1
vote
1
answer
229
views
How to copy the array with array.push() function without duplicate key value?
I am developing a food cart function where I am adding products to the cart. My cart is an Array type and the product is an object with key-values. The problem I am facing is, whenever I am trying to ...
0
votes
0
answers
207
views
How to remove items from an array on a checkout page
New to JS and trying to create a simple shopping cart using only vanilla JS. I have an item with details and an image that populates on a shopping cart page. I need to have a delete button that allows ...
0
votes
3
answers
371
views
How to remove a element from array cart in JS?
I have this array
[
0: {title: "Apple", price: 0.50, count: 1},
1: {title: "Pizza", price: 5.50, count: 1},
2: {title: "Hamburger", price: 4.50, count: 1},
3: ...