Misleading error message when the stock quantity is zero #3521

Closed
suyashtripathi opened this Issue Aug 8, 2013 · 17 comments

Comments

Projects
None yet
4 participants
@suyashtripathi

Using Spree Branch 2-0-stable.

Its not a functional issue as such but rather a misleading error message that kept me away for hours from the actual problem.

In core/config/locales/en.yml, the text for items_cannot_be_shipped says - "We are unable to ship the selected items to your shipping address. Please choose another shipping address."

Spree has a function ensure_available_shipping_rates in order.rb that checks if the shipments can be created and raises the error if its not able to do so.

Now if we have a scenario where quantities for a stock item are zero with backorders not allowed. When we submit the delivery information for the checkout the function ensure_available_shipping_rates gets invoked that has errors.add(:base, Spree.t(:items_cannot_be_shipped)) as the line for raising error. The actual problem here is that stock is zero or over but the error we get is "Choose a different shipping address". This might entirely confuse users/developers who might think there is something wrong in the address provided or the zipcode is blacklisted or so.

The error description needs a change so that it can capture a more useful error message.

@huoxito

This comment has been minimized.

Show comment
Hide comment
@huoxito

huoxito Aug 10, 2013

Member

Agreed. I think that message could say instead "We are unable to calculate shipping rates for the selected items" or something similar. Anyway I thought when a product was out of stock that's exactly what Spree would tell you that is "Product A is out of stock".

@suyashtripathi are you sure the reason you can't reach delivery page is a product is out of stock? and that spree displays another message instead? You shouldn't be able to get to address step in the first place if product is out of stock.

Member

huoxito commented Aug 10, 2013

Agreed. I think that message could say instead "We are unable to calculate shipping rates for the selected items" or something similar. Anyway I thought when a product was out of stock that's exactly what Spree would tell you that is "Product A is out of stock".

@suyashtripathi are you sure the reason you can't reach delivery page is a product is out of stock? and that spree displays another message instead? You shouldn't be able to get to address step in the first place if product is out of stock.

@suyashtripathi

This comment has been minimized.

Show comment
Hide comment
@suyashtripathi

suyashtripathi Aug 11, 2013

@huoxito - Yes even if the stock is zero, I am able to reach till the address page. And actually it doesnt matter where backorderable option is set or not, I get the same error always. But Yes, I remember earlier I was able to submit the order with the stock quantities 0 and only the shipment state used to be "backorder". I started getting this error message after applying the patch 3440. I feel I should have mentioned that explicitly in the issue. Apologies for the late addition.

@huoxito - Yes even if the stock is zero, I am able to reach till the address page. And actually it doesnt matter where backorderable option is set or not, I get the same error always. But Yes, I remember earlier I was able to submit the order with the stock quantities 0 and only the shipment state used to be "backorder". I started getting this error message after applying the patch 3440. I feel I should have mentioned that explicitly in the issue. Apologies for the late addition.

@huoxito

This comment has been minimized.

Show comment
Hide comment
@huoxito

huoxito Aug 11, 2013

Member

ah ok so you have track_inventory_levels false I suppose?. I can't see how the patch mentioned above would influence spree to display that message at all. That error is usually related to a product missing a shipping category or when the address chosen is not covered by any shipping method.

Member

huoxito commented Aug 11, 2013

ah ok so you have track_inventory_levels false I suppose?. I can't see how the patch mentioned above would influence spree to display that message at all. That error is usually related to a product missing a shipping category or when the address chosen is not covered by any shipping method.

@suyashtripathi

This comment has been minimized.

Show comment
Hide comment
@suyashtripathi

suyashtripathi Aug 12, 2013

@huoxito - I am afraid that's not true. I have "config.track_inventory_levels=true" in my spree.rb file. Do you suspect anything wrong? Can I provide any specific flows or other information from the setup?

@huoxito - I am afraid that's not true. I have "config.track_inventory_levels=true" in my spree.rb file. Do you suspect anything wrong? Can I provide any specific flows or other information from the setup?

@huoxito

This comment has been minimized.

Show comment
Hide comment
@huoxito

huoxito Aug 12, 2013

Member

For sure. Providing a step by step to reproduce the issue on a clean install would be great please. I still don't see any issue here other than improving the message displayed on checkout.

Member

huoxito commented Aug 12, 2013

For sure. Providing a step by step to reproduce the issue on a clean install would be great please. I still don't see any issue here other than improving the message displayed on checkout.

@suyashtripathi

This comment has been minimized.

Show comment
Hide comment
@suyashtripathi

suyashtripathi Aug 14, 2013

@huoxito - A clean install behaved as you had mentioned. Now I also feel that we just need to change the message displayed.

On 12-Aug-2013, at 10:42 PM, Washington L Braga Jr notifications@github.com wrote:

For sure. Providing a step by step to reproduce the issue on a clean install would be great please. I still don't see any issue here other than improving the message displayed on checkout.


Reply to this email directly or view it on GitHub.

@huoxito - A clean install behaved as you had mentioned. Now I also feel that we just need to change the message displayed.

On 12-Aug-2013, at 10:42 PM, Washington L Braga Jr notifications@github.com wrote:

For sure. Providing a step by step to reproduce the issue on a clean install would be great please. I still don't see any issue here other than improving the message displayed on checkout.


Reply to this email directly or view it on GitHub.

@huoxito

This comment has been minimized.

Show comment
Hide comment
@huoxito

huoxito Aug 14, 2013

Member

Not sure we understand each other here. I meant that the message you mentioned on this issue description should never be displayed because stock quantity is zero.

"We are unable to ship the selected items to your shipping address. Please choose another shipping address."

Member

huoxito commented Aug 14, 2013

Not sure we understand each other here. I meant that the message you mentioned on this issue description should never be displayed because stock quantity is zero.

"We are unable to ship the selected items to your shipping address. Please choose another shipping address."

@suyashtripathi

This comment has been minimized.

Show comment
Hide comment
@suyashtripathi

suyashtripathi Aug 14, 2013

I was getting this error earlier but after you mentioned, I did a clean install and the flow behaved as you had said - it didnt let me go till the address page. So I believe there was something wrong in my earlier installation; probably the db was not clean.

So I feel the flow is fine. My suggestion was if we could modify this error text in the spree code since its related to ensuring the shipping rates method and if the text could be in sync with that, it might be useful.

On 14-Aug-2013, at 7:42 AM, Washington L Braga Jr notifications@github.com wrote:

Not sure we understand each other here. I meant that the message you mentioned on this issue description should never be displayed because stock quantity is zero.

"We are unable to ship the selected items to your shipping address. Please choose another shipping address."


Reply to this email directly or view it on GitHub.

I was getting this error earlier but after you mentioned, I did a clean install and the flow behaved as you had said - it didnt let me go till the address page. So I believe there was something wrong in my earlier installation; probably the db was not clean.

So I feel the flow is fine. My suggestion was if we could modify this error text in the spree code since its related to ensuring the shipping rates method and if the text could be in sync with that, it might be useful.

On 14-Aug-2013, at 7:42 AM, Washington L Braga Jr notifications@github.com wrote:

Not sure we understand each other here. I meant that the message you mentioned on this issue description should never be displayed because stock quantity is zero.

"We are unable to ship the selected items to your shipping address. Please choose another shipping address."


Reply to this email directly or view it on GitHub.

@huoxito

This comment has been minimized.

Show comment
Hide comment
@huoxito

huoxito Aug 14, 2013

Member

ok thanks! just wanted to make sure we were on the same page

On Tue, Aug 13, 2013 at 11:24 PM, suyashtripathi
notifications@github.comwrote:

I was getting this error earlier but after you mentioned, I did a clean
install and the flow behaved as you had said - it didnt let me go till the
address page. So I believe there was something wrong in my earlier
installation; probably the db was not clean.

So I feel the flow is fine. My suggestion was if we could modify this
error text in the spree code since its related to ensuring the shipping
rates method and if the text could be in sync with that, it might be
useful.

On 14-Aug-2013, at 7:42 AM, Washington L Braga Jr <
notifications@github.com> wrote:

Not sure we understand each other here. I meant that the message you
mentioned on this issue description should never be displayed because stock
quantity is zero.

"We are unable to ship the selected items to your shipping address.
Please choose another shipping address."


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com/spree/spree/issues/3521#issuecomment-22611403
.

Washington L Braga Jr
Developer
Spree Commerce, Inc.

Member

huoxito commented Aug 14, 2013

ok thanks! just wanted to make sure we were on the same page

On Tue, Aug 13, 2013 at 11:24 PM, suyashtripathi
notifications@github.comwrote:

I was getting this error earlier but after you mentioned, I did a clean
install and the flow behaved as you had said - it didnt let me go till the
address page. So I believe there was something wrong in my earlier
installation; probably the db was not clean.

So I feel the flow is fine. My suggestion was if we could modify this
error text in the spree code since its related to ensuring the shipping
rates method and if the text could be in sync with that, it might be
useful.

On 14-Aug-2013, at 7:42 AM, Washington L Braga Jr <
notifications@github.com> wrote:

Not sure we understand each other here. I meant that the message you
mentioned on this issue description should never be displayed because stock
quantity is zero.

"We are unable to ship the selected items to your shipping address.
Please choose another shipping address."


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com/spree/spree/issues/3521#issuecomment-22611403
.

Washington L Braga Jr
Developer
Spree Commerce, Inc.

@lightcap

This comment has been minimized.

Show comment
Hide comment
@lightcap

lightcap Aug 18, 2013

@huoxito I'm seeing this same behavior with track_inventory_levels = false (since I want to turn inventory tracking off completely). But, that setting seems to bring about the error mentioned in this thread. Was there a particular reason you mentioned that config setting? Is this a known issue outside of this thread?

@huoxito I'm seeing this same behavior with track_inventory_levels = false (since I want to turn inventory tracking off completely). But, that setting seems to bring about the error mentioned in this thread. Was there a particular reason you mentioned that config setting? Is this a known issue outside of this thread?

@huoxito

This comment has been minimized.

Show comment
Hide comment
@huoxito

huoxito Aug 19, 2013

Member

@lightcap I don't think that setting is the responsible for the message "We are unable to ship the selected items to your shipping address. Please choose another shipping address." showing up. I mentioned it because of the PR mentioned here that involves that setting.

Member

huoxito commented Aug 19, 2013

@lightcap I don't think that setting is the responsible for the message "We are unable to ship the selected items to your shipping address. Please choose another shipping address." showing up. I mentioned it because of the PR mentioned here that involves that setting.

@lightcap

This comment has been minimized.

Show comment
Hide comment
@lightcap

lightcap Aug 19, 2013

@huoxito but I'm suggesting that it does affect the message. With the setting set to false I was unable to get past the shipping checkout screen. When it was changed to true it all worked again.

@huoxito but I'm suggesting that it does affect the message. With the setting set to false I was unable to get past the shipping checkout screen. When it was changed to true it all worked again.

@huoxito

This comment has been minimized.

Show comment
Hide comment
@huoxito

huoxito Aug 19, 2013

Member

Ok so could you give us some way to reproduce it on a fresh install please?
We need to know which products are you purchasing and how many stock do
they have. Last time I checked I couldn't reproduce that.

On Sun, Aug 18, 2013 at 9:46 PM, Matt Kern notifications@github.com wrote:

@huoxito https://github.com/huoxito but I'm suggesting that it does
affect the message. With the setting set to false I was unable to get past
the shipping checkout screen. When it was changed to true it all worked
again.


Reply to this email directly or view it on GitHubhttps://github.com/spree/spree/issues/3521#issuecomment-22845626
.

Washington L Braga Jr
Developer
Spree Commerce, Inc.

Member

huoxito commented Aug 19, 2013

Ok so could you give us some way to reproduce it on a fresh install please?
We need to know which products are you purchasing and how many stock do
they have. Last time I checked I couldn't reproduce that.

On Sun, Aug 18, 2013 at 9:46 PM, Matt Kern notifications@github.com wrote:

@huoxito https://github.com/huoxito but I'm suggesting that it does
affect the message. With the setting set to false I was unable to get past
the shipping checkout screen. When it was changed to true it all worked
again.


Reply to this email directly or view it on GitHubhttps://github.com/spree/spree/issues/3521#issuecomment-22845626
.

Washington L Braga Jr
Developer
Spree Commerce, Inc.

@lightcap

This comment has been minimized.

Show comment
Hide comment
@lightcap

lightcap Aug 19, 2013

Yup I'm working on that now.

Yup I'm working on that now.

@radar

This comment has been minimized.

Show comment
Hide comment
@radar

radar Sep 4, 2013

Member

Is #3590 supposed to be a fix for this issue?

Member

radar commented Sep 4, 2013

Is #3590 supposed to be a fix for this issue?

@huoxito

This comment has been minimized.

Show comment
Hide comment
@huoxito

huoxito Sep 4, 2013

Member

I think so

Member

huoxito commented Sep 4, 2013

I think so

@radar

This comment has been minimized.

Show comment
Hide comment
@radar

radar Sep 4, 2013

Member

Ok, good. I will close this issue then.

Member

radar commented Sep 4, 2013

Ok, good. I will close this issue then.

@radar radar closed this Sep 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment