Skip to content

Commit dae1616

Browse files
committed
Minor improvements
1 parent 629878a commit dae1616

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

components/Cart/CartPage/CartItem.component.jsx

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,11 @@ import { v4 } from 'uuid';
33

44
import SVGX from 'components/SVG/SVGX.component';
55

6-
import { getUpdatedItems } from '../../../utils/functions/functions';
6+
import { getUpdatedItems } from 'utils/functions/functions';
77

8-
const CartItem = ({
9-
item,
10-
products,
11-
handleRemoveProductClick,
12-
updateCart,
13-
}) => {
8+
const CartItem = ({ item, products, handleRemoveProductClick, updateCart }) => {
149
const [productCount, setProductCount] = useState(item.qty);
1510

16-
console.log("Update cart: ");
17-
console.log(updateCart);
18-
1911
/*
2012
* When user changes the quantity, update the cart in localStorage
2113
* Also update the cart in the global Context
@@ -27,18 +19,17 @@ const CartItem = ({
2719
const handleQuantityChange = (event, cartKey) => {
2820
if (process.browser) {
2921
event.stopPropagation();
30-
// If the previous update cart mutation request is still processing, then return.
31-
32-
/*if (updateCartProcessing) {
22+
// Return if the previous update cart mutation request is still processing
23+
/*
24+
if (updateCartProcessing) {
3325
return;
3426
}*/
3527
// If the user tries to delete the count of product, set that to 1 by default ( This will not allow him to reduce it less than zero )
3628
const newQty = event.target.value ? parseInt(event.target.value) : 1;
37-
// Set the new qty in state.
29+
// Set the new quantity in state.
3830
setProductCount(newQty);
3931
if (products.length) {
4032
const updatedItems = getUpdatedItems(products, newQty, cartKey);
41-
4233
updateCart({
4334
variables: {
4435
input: {
@@ -50,7 +41,6 @@ const CartItem = ({
5041
}
5142
}
5243
};
53-
5444
return (
5545
<tr className="bg-gray-100">
5646
<td className="px-4 py-2 border">

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-woocommerce",
3-
"version": "0.8.5",
3+
"version": "0.9.0",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)