Skip to content

Commit

Permalink
[2.x] Disable checkout button and add notice if not in stock (#127)
Browse files Browse the repository at this point in the history
* Disable checkout button and add notice if not in stock

* Div to span
  • Loading branch information
BobWez98 authored Nov 5, 2024
1 parent 289f0b8 commit 22d7163
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions resources/views/cart/partials/product/description.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<div v-for="option in item.customizable_options">
@{{ option.label }}: @{{ option.values[0].label || option.values[0].value }}
</div>
<div class="text-red-600" v-if="!canOrderCartItem(item)">
@lang('This product it out of stock, remove it to continue your order.')
</div>
<div v-for="option in config.cart_attributes">
<template v-if="item.product.attribute_values?.[option] && typeof item.product.attribute_values[option] === 'object'">
@{{ option }}: <span v-html="item.product.attribute_values[option]?.join(', ')"></span>
Expand Down
17 changes: 11 additions & 6 deletions resources/views/cart/partials/sidebar/summary.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@
<dd>@{{ cart.prices.grand_total.value | price }}</dd>
</div>
</x-rapidez-ct::separated-listing>

<x-rapidez-ct::button.enhanced :href="route('checkout')" class="flex w-full items-center justify-center gap-1 mt-6" dusk="checkout">
@lang('To checkout')
<x-heroicon-o-arrow-right class="h-4" />
</x-rapidez-ct::button.enhanced>

<div class="w-full" :class="{ 'cursor-not-allowed': !canOrder }">
<x-rapidez-ct::button.enhanced
:href="route('checkout')"
class="flex w-full items-center justify-center gap-1 mt-6"
v-bind:class="{ 'pointer-events-none': !canOrder }"
dusk="checkout"
>
@lang('To checkout')
<x-heroicon-o-arrow-right class="h-4" />
</x-rapidez-ct::button.enhanced>
</div>
<div class="mt-4 flex items-center justify-center gap-1 text-center text-sm">
<x-heroicon-o-check class="h-5 text-ct-accent" />
@lang('Ordered within 2 minutes')
Expand Down

0 comments on commit 22d7163

Please sign in to comment.