@nuskin/ns-shop 7.7.0-pa-902.1 → 7.7.0-pa-902.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cart/cartService.js +7 -0
package/package.json
CHANGED
package/src/cart/cartService.js
CHANGED
|
@@ -355,6 +355,9 @@ function itemIsAvailable(product) {
|
|
|
355
355
|
*/
|
|
356
356
|
async function addProductToCart(options) {
|
|
357
357
|
await awaitForConfig();
|
|
358
|
+
if (!canUserAddToCart()) {
|
|
359
|
+
throw new Error();
|
|
360
|
+
}
|
|
358
361
|
let cart = _getCart();
|
|
359
362
|
|
|
360
363
|
if (!options.sapLineId && !itemIsAvailable(options.product)) {
|
|
@@ -423,6 +426,10 @@ async function addProductToCart(options) {
|
|
|
423
426
|
* }
|
|
424
427
|
*/
|
|
425
428
|
async function addSkuToCart(options) {
|
|
429
|
+
if (!canUserAddToCart()) {
|
|
430
|
+
throw new Error();
|
|
431
|
+
}
|
|
432
|
+
|
|
426
433
|
let retVal,
|
|
427
434
|
response = await ProductService.getProductBySku(options),
|
|
428
435
|
product = response.success && response.product;
|