wajdi's avatar
Level 2

Shopping cart with vueJs and laravel using Crinsane/LaravelShoppingcart

Hello, I want to implement shopping cart functionality in my ecommerce website so for that i googled for a package and i found Crinsane/LaravelShoppingcart in packagist.org i followed the instructions and everything is working but the problem is that when i hit the add to cart button it reloads all the page (which i dislike) in fact i want to use vuejs to perform this action based on Crinsane/LaravelShoppingcart I'm pretty good with laravel but this my first time with vuejs how can I accomplish this ?

0 likes
5 replies
topvillas's avatar

It might get more complicated but create an endpoint to send an AJAX request to which implements the API for adding things to the cart. Then on success send the item back to the client and add it to a local cart. The important part is making sure the cart data on the client is in sync with the server, so there's no surprises for the user.

martinbean's avatar

i want to use vuejs to perform this action based on Crinsane/LaravelShoppingcart I'm pretty good with laravel but this my first time with vuejs how can I accomplish this ?

@wajdi Well to accomplish it, you need to learn Vue.js. You can’t implement a feature in a technology you don’t know :)

wajdi's avatar
Level 2

@martinbean Well I already did some research, i'm a quick learner And to note my code is setup there's just something missing so i posted this

wajdi's avatar
Level 2

@topvillas , I have that endpoint in my controller function I writed that everything is working using Crinsane/LaravelShoppingcart I just want to attach it to a Vuejs event

Please or to participate in this conversation.