Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ecommerce-maven
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
ecommerce-maven
Commits
39ca21a0
Commit
39ca21a0
authored
May 11, 2021
by
Shaphen Pangburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AFP-48 Shaphen Pangburn]: Increase quantity of existing produc tin cart if already existing
parent
56cd049f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
product-item.jsx
ecom-web/src/components/product-market/product-item.jsx
+8
-0
No files found.
ecom-web/src/components/product-market/product-item.jsx
View file @
39ca21a0
...
...
@@ -35,6 +35,14 @@ export default class ProductItem extends Component {
userId
:
this
.
props
.
user
.
currentUser
.
email
,
cartItems
:
JSON
.
parse
(
JSON
.
stringify
(
this
.
props
.
cart
))
// JSON.parse/stringify will deep-dup the object
})
for
(
let
i
=
0
;
i
<
newCart
.
cartItems
.
length
;
i
++
)
{
let
item
=
newCart
.
cartItems
[
i
];
if
(
item
.
productRef
.
sku
===
product
.
sku
)
{
item
.
quantity
+=
parseInt
(
this
.
state
.
orderItemQuantity
)
this
.
props
.
addToCart
(
newCart
,
this
.
props
.
user
.
currentUser
.
email
);
return
;
}
}
const
newCartItem
=
{
productRef
:
{
id
:
product
.
sku
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment