commerce
commerce copied to clipboard
BigCommerce useUpdateItem/useAddItem Minimum and Maximum
Hi, I'm attempting to make the min/max items functionality with BigCommerce.
The way BigCommerce does it, is that when more (or less) than min/max is added to the cart, BigCommerce returns this error:
res: Response { size: 0, timeout: 0, [Symbol(Body internals)]: { body: [Gunzip], disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'https://35.227.219.245/stores/***/v3/carts/***?include=line_items.physical_items.options', status: 422, statusText: 'Unprocessable Entity', headers: [Headers], counter: 0 }, [Symbol(dnsCachedUrl)]: 'https://35.227.219.245/stores/***/v3/carts/***?include=line_items.physical_items.options' }, data: '{"status":422,"title":"You can only purchase a maximum of 2 of the [Sample] Dustpan & Brush per order.","type":"https://developer.bigcommerce.com/api-docs/getting-started/api-status-codes"}' }
However the useUpdateItem and useAddItem functions don't seem to handle errors from the provider (in this case BigCommerce). Instead, it just kills the whole thing.
I'm wondering what I'd have to do in order to get error handling in place for provider responses?
Thanks