You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
i am getting this error "checkout.js:40 Uncaught TypeError: Cannot read properties of undefined (reading 'deliveryDays') and i have exactly followed the video i dont know whats wrong #148
checkout.js:40 Uncaught TypeError: Cannot read properties of undefined (reading 'deliveryDays')
at checkout.js:40:47
at Array.forEach ()
at renderOrderSummary (checkout.js:13:8)
at checkout.js:203:1
i have attached the picture showing where it originates
also if anyone wanna get in touch, help explain it or do the rest of the project together, here is my discord:willbettelheim6027
checkout.js:40 Uncaught TypeError: Cannot read properties of undefined (reading 'deliveryDays') at checkout.js:40:47 at Array.forEach () at renderOrderSummary (checkout.js:13:8) at checkout.js:203:1
i have attached the picture showing where it originates
also if anyone wanna get in touch, help explain it or do the rest of the project together, here is my discord:willbettelheim6027
unable to find you DISCORD here my Discord username : rockingshri27
i am getting this error in console:
checkout.js:40 Uncaught TypeError: Cannot read properties of undefined (reading 'deliveryDays') at checkout.js:40:47 at Array.forEach () at renderOrderSummary (checkout.js:13:8) at checkout.js:203:1
i have attached the picture showing where it originates
also if anyone wanna get in touch, help explain it or do the rest of the project together, here is my discord:willbettelheim6027
heyy!! Check if you have imported deliveryOptions correctly! This simply means your current file thinks that deliveryDays doesn't exist which could be import issue or spelling issue of the property!
I had same issues, was stocked for about 3 days, the solution is
const deliveryDate = today.add(deliveryOptions.deliveryDays, 'days'); they should be an s on the deliveryOption.
then if it shows again, dont delete the s, just use this command on the console
localStorage.clear()
//updating delivery date to the actual date.
const deliveryOptionsId = cartItem.deliveryOptionsId;
let deliveryOption;
deliveryOptions.forEach((Option) =>{
if(Option.id === deliveryOptionsId){
deliveryOption = Option
}
});
I had same issues, was stocked for about 3 days, the solution is const deliveryDate = today.add(deliveryOptions.deliveryDays, 'days'); they should be an s on the deliveryOption. then if it shows again, dont delete the s, just use this command on the console localStorage.clear()
//updating delivery date to the actual date. const deliveryOptionsId = cartItem.deliveryOptionsId; let deliveryOption; deliveryOptions.forEach((Option) =>{ if(Option.id === deliveryOptionsId){ deliveryOption = Option } });
Thank You. It finally helped. I used "deliveryOption.deliveryDays" instead of "deliveryOptions.deliveryDays". Such a relief. But, now I am getting an error with my radio button, I am unable to select any option for the delivery :(.
I had same issues, was stocked for about 3 days, the solution is const deliveryDate = today.add(deliveryOptions.deliveryDays, 'days'); they should be an s on the deliveryOption. then if it shows again, dont delete the s, just use this command on the console localStorage.clear()
//updating delivery date to the actual date. const deliveryOptionsId = cartItem.deliveryOptionsId; let deliveryOption; deliveryOptions.forEach((Option) =>{ if(Option.id === deliveryOptionsId){ deliveryOption = Option } });
Thank You. It finally helped. I used "deliveryOption.deliveryDays" instead of "deliveryOptions.deliveryDays". Such a relief. But, now I am getting an error with my radio button, I am unable to select any option for the delivery :(.
Activity
Fz-Faiz commentedon Sep 13, 2024
You can try localStorage.clear() in console

[
]
banda-shri1998 commentedon Oct 1, 2024
adding
debuggerbefore the line where error occurs while checking flow of execution becomes much easier to resolve by you ownosmvenkat commentedon Oct 31, 2024
SAME PROBLEM WITH ME DO YOU FIND SOLUTION
banda-shri1998 commentedon Nov 2, 2024
unable to find you DISCORD here my Discord username : rockingshri27
Roopam-98 commentedon Jan 2, 2025
heyy!! Check if you have imported deliveryOptions correctly! This simply means your current file thinks that deliveryDays doesn't exist which could be import issue or spelling issue of the property!
banda-shri1998 commentedon Jan 3, 2025
Instagram
here is my insta ID to contact me so we can solve together
Roopam-98 commentedon Jan 4, 2025
Could you share your email? Or maybe your github repo used or amazon clone
banda-shri1998 commentedon Jan 5, 2025
@Roopam-98
heres my gmail :- banda.shri2710@gmail.com
ElementalcodeIn commentedon Jan 26, 2025
Hii... Everyone, so this is the solution of this Error.
The error
Cannot read properties of undefined (reading 'deliveryDays')indicates thatdeliveryOption is
undefinedat line 32 in checkout.jsThis means that the deliveryOptionId from cartItem does not match any id in deliveryOptions.
To fix this, you should add a check to ensure deliveryOption is found before trying to access its properties. Here's the updated code:
...
cart.forEach((cartItem) => {
const productId = cartItem.productId;
let matchingProduct;
products.forEach((product) => {
if (product.id === productId) {
matchingProduct = product;
}
});
const deliveryOptionId = cartItem.deliveryOptionsId;
let deliveryOption;
deliveryOptions.forEach((option) => {
if (option.id === deliveryOptionId) {
deliveryOption = option;
}
});
if (!deliveryOption) {
console.error(
Delivery option with id ${deliveryOptionId} not found);return;
}
const today = dayjs();
const deliveryDate = today.add(deliveryOption.deliveryDays, "days");
const dateString = deliveryDate.format('dddd, MMMM D');
cartSummaryHTMl += `
This will log an error message if a deliveryOption is not found and prevent the code from trying to access properties of
undefined.Hope it will help you all and happy coding 👍
Georgeikani commentedon Feb 10, 2025
I had same issues, was stocked for about 3 days, the solution is
const deliveryDate = today.add(deliveryOptions.deliveryDays, 'days'); they should be an s on the deliveryOption.
then if it shows again, dont delete the s, just use this command on the console
localStorage.clear()
//updating delivery date to the actual date.
const deliveryOptionsId = cartItem.deliveryOptionsId;
let deliveryOption;
deliveryOptions.forEach((Option) =>{
if(Option.id === deliveryOptionsId){
deliveryOption = Option
}
});
Ishaprof0510 commentedon Mar 6, 2025
Thank You. It finally helped. I used "deliveryOption.deliveryDays" instead of "deliveryOptions.deliveryDays". Such a relief. But, now I am getting an error with my radio button, I am unable to select any option for the delivery :(.
Can you help please?
Bami97 commentedon Aug 22, 2025
I have tried all solutions listed but none worked, can someone please help.
Bami97 commentedon Aug 22, 2025
Hey Ishaprof0510, have you fixed this?