Facade And Model Method Added
This commit is contained in:
parent
5dce2f1a95
commit
88e85cbbe3
|
|
@ -293,7 +293,7 @@ class Cart
|
|||
public function getItemByProduct($data)
|
||||
{
|
||||
$items = $this->getCart()->all_items;
|
||||
|
||||
|
||||
foreach ($items as $item) {
|
||||
if ($item->product->getTypeInstance()->compareOptions($item->additional, $data['additional'])) {
|
||||
if (isset($data['additional']['parent_id'])) {
|
||||
|
|
@ -607,7 +607,7 @@ class Cart
|
|||
|
||||
if ($validationResult->isItemInactive()) {
|
||||
$this->removeItem($item->id);
|
||||
|
||||
|
||||
$isInvalid = true;
|
||||
|
||||
session()->flash('info', __('shop::app.checkout.cart.item.inactive'));
|
||||
|
|
@ -708,7 +708,7 @@ class Cart
|
|||
|
||||
$item->save();
|
||||
}
|
||||
|
||||
|
||||
Event::dispatch('checkout.cart.calculate.items.tax.after', $cart);
|
||||
}
|
||||
|
||||
|
|
@ -1275,4 +1275,20 @@ class Cart
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check minimum order.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function checkMinimumOrder(): bool
|
||||
{
|
||||
$cart = $this->getCart();
|
||||
|
||||
if (! $cart) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $cart->checkMinimumOrder();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Webkul\Checkout\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\Product\Models\ProductProxy;
|
||||
use Webkul\Checkout\Contracts\Cart as CartContract;
|
||||
|
||||
class Cart extends Model implements CartContract
|
||||
|
|
@ -169,4 +168,18 @@ class Cart extends Model implements CartContract
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check minimum order.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function checkMinimumOrder(): bool
|
||||
{
|
||||
$minimumOrderAmount = (float) core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0;
|
||||
|
||||
$cartBaseSubTotal = (float) $this->base_sub_total;
|
||||
|
||||
return $cartBaseSubTotal >= $minimumOrderAmount;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue