i am building an e-commerce website with laravel 5.2
I can add my products to my shopping cart, which is stored in a session. I can view my shopping cart & when i click confirm i go to a checkout page.
Shopping Cart (working as intended):
All my items on the checkout page are still only in the session. Is this good practice or should i store stuff in de database after i go to the checkout page? .
On my checkout page i have a couple of radio-buttons to select the shipping method. I would like to make a calculation based upon my selection. What is the best way to handle this? I would like to avoid putting a submit button below the radio-buttons to confirm the selection. An important notice is that i also have a field for a Coupon code on this page which i calculate using a get request. So refreshing the page is not really an option because my coupon calculation will be gone.
Checkout page: (Radio-buttons are here)
2 Options i can think of:
Make the calculation on the client side with javascript and add hidden input fields for when the user clicks confirm order they get saved into the database table for orders.
Start saving data in de database after the shopping cart, the problem with this approach is that a lot of data is still missing. Like the correct shipping/billing address.