Skip to content

Commit d707d12

Browse files
authored
Merge pull request #196 from w3bdesign/development
Some debugging
2 parents 62875c6 + 25abbaa commit d707d12

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141

4242
## TODO
4343

44-
- Display product variation in cart / checkout
44+
- Display product variation name in cart / checkout
45+
- Implement React-hook-form for validation
4546
- Hide products not in stock
4647
- Add better SEO
4748
- Add a better README.md

components/Cart/AddToCartButton.component.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ const AddToCartButton = (props) => {
2525

2626
const product = props.product;
2727

28+
const productId = product.productId ? product.productId : product;
29+
30+
console.log("Props from Addtocart");
2831
console.log(props);
2932

3033
const productQueryInput = {
3134
clientMutationId: uuidv4(), // Generate a unique id.
3235
//productId: product.productId,
33-
productId: product
36+
//productId: product
37+
productId: productId
3438
};
3539

3640
// Get Cart Data.

components/Cart/CartPage/CartItem.component.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ import { getUpdatedItems } from 'utils/functions/functions';
77
const CartItem = ({ item, products, handleRemoveProductClick, updateCart }) => {
88
const [productCount, setProductCount] = useState(item.qty);
99

10+
console.log("Cart item: ");
11+
console.log(item);
12+
console.log("Cart products: ");
13+
console.log(products);
14+
15+
1016
/*
1117
* When user changes the quantity, update the cart in localStorage
1218
* Also update the cart in the global Context

components/Product/SingleProduct.component.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component';
1010
*/
1111
const SingleProduct = ({ product }) => {
1212
const [isLoading, setIsLoading] = useState(true);
13-
// Set first variation as default selected variant
14-
const [selectedVariation, setselectedVariation] = useState(
15-
product.variations.nodes[0].variationId
16-
);
13+
const [selectedVariation, setselectedVariation] = useState(64);
1714

1815
useEffect(() => {
1916
setIsLoading(false);

0 commit comments

Comments
 (0)