summaryrefslogtreecommitdiff
path: root/src/pages/shop/product
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/shop/product')
-rw-r--r--src/pages/shop/product/[slug].js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pages/shop/product/[slug].js b/src/pages/shop/product/[slug].js
index 9bb76fb6..de52eb72 100644
--- a/src/pages/shop/product/[slug].js
+++ b/src/pages/shop/product/[slug].js
@@ -10,6 +10,7 @@ import "react-lazy-load-image-component/src/effects/blur.css";
import ProductSlider from "../../../components/product/ProductSlider";
import Layout from "../../../components/Layout";
import { createOrUpdateItemCart } from "../../../helpers/cart";
+import toast from "react-hot-toast";
export async function getServerSideProps( context ) {
const { slug } = context.query;
@@ -83,6 +84,7 @@ export default function ProductDetail({ product }) {
let addItemToCart = () => {
if (quantity > 0) {
+ toast.success('Berhasil menambahkan ke keranjang', { duration: 1500 });
createOrUpdateItemCart(activeVariant.id, parseInt(quantity));
}
return true;
@@ -143,7 +145,7 @@ export default function ProductDetail({ product }) {
<button
className="btn-yellow w-full"
onClick={addItemToCart}
- disabled={(product.lowest_price.price == 0 ? true : false)}
+ disabled={(product.lowest_price.price == 0 ? true : false) || (product.variant_total > 1 && !selectedVariant)}
>
+ Keranjang
</button>