Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Addresses and Cards by ID #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cart.js: No 'new' on util.error
amnotafraid committed Apr 3, 2017
commit 894e2b11263799f3946fc118c55ea8e115aae748
8 changes: 4 additions & 4 deletions api/v1/cart.js
Original file line number Diff line number Diff line change
@@ -368,10 +368,10 @@ cart.validateProduct = (schema, data) => {
var productId = product.id;
var variantId = product.variant && product.variant.id;
if (!product.id) {
throw new util.error(400, 'Product not found');
throw util.error(400, 'Product not found');
}
if (product.delivery === 'subscription') {
throw new util.error(400, 'Subscription products cannot be added to a cart');
throw util.error(400, 'Subscription products cannot be added to a cart');
}
if (product.variable && !data.variant_id) {
// Return first variant
@@ -386,10 +386,10 @@ cart.validateProduct = (schema, data) => {
});
}
if (data.variant_id && !product.variant) {
throw new util.error(400, 'Variant not found for this product (' + product.name + ')');
throw util.error(400, 'Variant not found for this product (' + product.name + ')');
}
if (data.variant_id && !product.variable) {
throw new util.error(400, 'Product is not variable (' + product.name + ')');
throw util.error(400, 'Product is not variable (' + product.name + ')');
}
// Valid
data.product_id = productId;