Components
Cart Button
The Cart Button component allows you to add a Price to the Cart. This is useful for allowing users to add multiple items to their Cart before checking out with all items at once.
Return URL
You can specify a return URL for the Cart Button that the user will be redirected to after they successfully add an item to their Cart. The default return URL is the page the user is currently on.
1<x-conduit::cart-button :price="$price->price_id" returnUrl="/cart">2 Add to Cart3</x-conduit::cart-button>4 5{{-- OR --}}6 7<x-conduit::cart-button :price="$price->price_id" :returnUrl="route('cart')">8 Add to Cart9</x-conduit::cart-button>
Example
You can create a Cart Button by passing it a $price
prop. This can either by a
Price model or the Price's $price->price_id
.
You can also pass a $quantity
prop to specify the quantity of the item to add to the Cart. This
defaults to 1.
1<x-conduit::cart-button :price="\Mergeloop\Conduit\Models\Price::find(1)"> 2 Add to Cart 3</x-conduit::cart-button> 4 5{{-- OR --}} 6 7<x-conduit::cart-button :price="$price->price_id" :quantity="10"> 8 Add to Cart 9</x-conduit::cart-button>10 11{{-- OR --}}12 13<x-conduit::cart-button :price="$price->price_id" class="px-4 py-2 text-gray-700 hover:text-black">14 Add to Cart15</x-conduit::cart-button>