on ‎2018 Mar 09 10:00 AM
Request clarification before answering.
Hi Aditi,
Surely the cart is a secured area, unless you are talking about a Public Gift List for a wedding.
In the OOTB Storefront, the Cart Page being a secured area, the user will need to login. So the standard URL to the Cart page will be sufficient.
If you're using OCC v2, the Sample Flows can guide you.
If you're talking about a custom storefront, the WebService API - Reference documentation there isn't a direct way to get a User's Carts. So we'll have to write our own.
From the logged in User use:
@GetMapping("user/{userId}/cart")
public CartModel getLastModifiedCartForUser(@PathVariable String userId) {
return userService.getUserForUID(userId)
.getCarts()
.stream()
.sorted(Comparator.comparing(CartModel::getModifiedtime)
.reversed())
.collect(Collectors.toList())
.first();
}
Obviously, lastModifiedtime presents it's own problems, as an older User's Cart could've been modified by a CronJob. But this is just a trivial example.
JavaDoc: userService.getUserforUID | userModel.getCarts | CartModel
Regards,
Luke
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.