The error is :
Route [product.cart] not defined.
Here is the route
Route::get('/cart' , CartComponent::class , 'store')->name('product.cart');
this is line of view where I want that route View Page shop-component.balde.php
<a href="#" class="btn add-to-cart" wire:click.prevent="store({{$product->id }} , '{{$product->name}}' , {{$product->regular_price}} )">Add To Cart</a>
and this one is the Shop Component code
namespace App\Http\Livewire;
use Livewire\Component;
use Livewire\WithPagination;
use App\Models\Product;
use Cart;
class ShopComponent extends Component
{
public function store($product_id , $product_name , $product_price)
{
Cart::add($product_id , $product_name , 1 , $product_price)->associate('App\Models\Product');
session()->flash('success_message' , 'Item Successfully Add');
return redirect()->route('product.cart');
}
public function render()
{
$products = Product::paginate(12);
return view('livewire.shop-component',['products' => $products])->layout('layouts.base');
}
}