diff --git a/frontend/src/screens/PlaceOrderScreen.js b/frontend/src/screens/PlaceOrderScreen.js index d504c6d04..bbaa193b2 100644 --- a/frontend/src/screens/PlaceOrderScreen.js +++ b/frontend/src/screens/PlaceOrderScreen.js @@ -22,11 +22,6 @@ function PlaceOrderScreen({ history }) { cart.totalPrice = (Number(cart.itemsPrice) + Number(cart.shippingPrice) + Number(cart.taxPrice)).toFixed(2) - - if (!cart.paymentMethod) { - history.push('/payment') - } - useEffect(() => { if (success) { history.push(`/order/${order._id}`) diff --git a/frontend/src/store.js b/frontend/src/store.js index ee50edbbd..840a35bcd 100644 --- a/frontend/src/store.js +++ b/frontend/src/store.js @@ -69,11 +69,14 @@ const userInfoFromStorage = localStorage.getItem('userInfo') ? const shippingAddressFromStorage = localStorage.getItem('shippingAddress') ? JSON.parse(localStorage.getItem('shippingAddress')) : {} +const paymentMethodFromStorage = localStorage.getItem('paymentMethod') ? + JSON.parse(localStorage.getItem('paymentMethod')) : {} const initialState = { cart: { cartItems: cartItemsFromStorage, shippingAddress: shippingAddressFromStorage, + paymentMethod: paymentMethodFromStorage }, userLogin: { userInfo: userInfoFromStorage }, }