Laravel 9 Tutorial #125 | Laravel Discount Codes (VI) | Apply Discount Coupon at Shopping Cart Page

Laravel 9 Tutorial #125 | Laravel Discount Codes (VI) | Apply Discount Coupon at Shopping Cart Page

Stack Developers

1 год назад

1,027 Просмотров

►Laravel 9 Tutorial from the beginning:- https://www.youtube.com/playlist?list=PLLUtELdNs2ZYTlQ97V1Tl8mirS3qXHNFZ

In Part 125 of the Laravel 9 Tutorial to create a Multi-Vendor E-commerce Website in Laravel 9, we will continue working on the Coupons module.

In this video, we will start applying coupon at shopping cart. One by one we will check all conditions in Ajax for coupons and if fine then we will apply coupon and update Grand total after showing discount. We will also ask user to login if want to apply coupon.

1) Update cart_items.blade.php
Update "Apply Coupon" form by adding form action, coupon field and type submit to apply the coupon in Ajax. We will add ApplyCoupon form id to run jQuery to apply Coupon via Ajax.

We will pass user as 1 in form if user is logged in so that we can add check in jQuery to ask the user to logged in to apply the coupon.

2) Update custom.js file :-
Add ApplyCoupon jQuery code at custom.js file where we will first check if user is logged in and if user is logged in then we pass coupon code to apply-coupon route via Ajax to apply the coupon if valid.

3) Create Route :-
Now create Post route for apply coupon in web.php file like below :-

// Apply Coupon
Route::post('/apply-coupon','ProductsController@applyCoupon');

4) Create applyCoupon function :-
Now create applyCoupon function in CouponsController and check if coupon code is correct or not. If not correct then we will return error message and alert via Ajax response.

5) Update custom.js file :-
Update response of Ajax to alert error message in case coupon is incorrect and re-load cart items.

In next video, we will work on other coupon conditions like coupon is inactive or not, coupon is expired or not, coupon is from selected categories, coupon is from selected users etc.

►Laravel 9 Tutorial Playlist (Create Multi-Vendor E-commerce Website) - https://www.youtube.com/playlist?list=PLLUtELdNs2ZYTlQ97V1Tl8mirS3qXHNFZ

►Click here to subscribe for Laravel & other updates - https://www.youtube.com/stackdevelopers

Popular Stack Developers Series that can help you:-

►React JS Tutorial for Beginners with Laravel 9 - https://www.youtube.com/playlist?list=PLLUtELdNs2ZYnEIWliBpU98gtorNRNHw1

►Laravel Tutorial for Beginners - https://www.youtube.com/playlist?list=PLLUtELdNs2ZaHaFmydqjcQ-YyeQ19Cd6u

►GIT Tutorial for Beginners - https://www.youtube.com/playlist?list=PLLUtELdNs2ZZVQ-dLOMFWvmCCduzJ8c6R

►Laravel API Tutorial - https://www.youtube.com/playlist?list=PLLUtELdNs2ZbcCsd4yAAiBU2L3ROREk8P

►Laravel Interview Questions - https://www.youtube.com/playlist?list=PLLUtELdNs2ZbzB_1Jdp_yFcORwOfWP8RU

►jQuery Tutorial - https://www.youtube.com/playlist?list=PLLUtELdNs2ZbMYoUA46GIonOH29KcjtxA

►Laravel Basic E-commerce Series - https://www.youtube.com/playlist?list=PLLUtELdNs2ZY5drPxIWzpq5crhantlzp7

►Laravel Dating Series - https://www.youtube.com/playlist?list=PLLUtELdNs2ZZrPUnxjlomErJfNvkyS6Hf

►Join this channel to get the complete source code of all series:
https://www.youtube.com/channel/UCExO2i-tLU1NyVZD6zOJQlw/join

Follow Stack Developers on Social Media to get updates and resolve your queries
►Like Facebook Page to get updates - http://facebook.com/stackdevelopers2/
►Join Facebook Group to resolve your queries - http://facebook.com/groups/stackdevelopers
►Follow on Instagram - https://www.instagram.com/stackdevelopers2/
►Follow on GitHub - https://github.com/stackdevelopers

#laravel9 #laravel9tutorial #laravel

Тэги:

#laravel_9 #laravel9 #laravel_9_tutorial #create_multi_vendor_ecommerce_website #create_laravel_9_website #multi-vendor_ecommerce_in_laravel_9 #laravel_9_ecommerce #multi_vendor #multi_vendor_ecommerce #multi_seller_ecommerce #multiseller_ecommerce_tutorial #laravel_9_series #laravel_9_website_tutorial #multivendor_laravel #laravel_9_website #learn_laravel_9 #laravel_9_tutorial_for_beginners #laravel_discount_codes #apply_coupon_at_shopping_cart_laravel #apply_coupon_laravel
Ссылки и html тэги не поддерживаются


Комментарии:

@devnayem
@devnayem - 24.03.2023 09:27

Thanks a lot...

Ответить
@shivendratripathi9916
@shivendratripathi9916 - 22.12.2022 11:32

Sir can you send me your coupon apply code
There is error coming please to apply coupon and i am login after that his is coming

Ответить
@alimousakhani1611
@alimousakhani1611 - 21.12.2022 23:32

Hello sir, thank you for this great tutorial
Please also explain about making the site multi-language
Thank you🙏

Ответить
@MuhammadImran-tb4xy
@MuhammadImran-tb4xy - 21.12.2022 13:27

hI sir Amit
There is one issue if once an error comes coupon is not valid, then try with another invalid or valid coupon code apply coupon button is not working, after refreshing the page coupon button works again. can you help to resolve this issue?

Ответить
@milanindiketiya5608
@milanindiketiya5608 - 21.12.2022 09:02

Sms api not working i am from srilanka 🥲

Ответить
@danishmirza5857
@danishmirza5857 - 21.12.2022 08:49

Sir when will be the next video come????

Ответить
@alimousakhani1611
@alimousakhani1611 - 20.12.2022 12:35

thanks alot

Ответить