Skip to content
Merged
Changes from all commits
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
8 changes: 4 additions & 4 deletions api/v1/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down