Bug with Stock Management?

  • Posts: 3
  • Thank you received: 0
  • Hikashop Business
3 weeks 2 days ago #321058

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.4.6
-- Browser(s) name and version -- : Chrome 83.0.4103.106

Hi

We're setting up a new shop with Hikashop Business, but we're not selling the items but rent them. So all items need to be put back in stock when the order is finished.
I've just set up the stock management so items are substracted from stock when the order is created and added again when the order gets a status with "cancelled" (eg "Items returned", "Order cancelled", ...).
That part actually works fine.

What I got issues is when I played around with the status and didn't follow the regular expected status ordering. So when I (accidentally) set the order to a "cancelled" status and then back to a "non-cancelled" status, or when I go from the "created" to "confirmed" and then back to "created", the stock management doesn't calculate the amount anymore correctly. I've ended up several times where the items where substraced permanently and I couldn't get them in stock again using the order statuses.

What I would expect is that items are substracted each time I go from a "cancelled" status to "non-cancelled" and added again when going the other way.

Now I'm not sure if I messed up something with the config or if that is a bug in HikaShop stock management or if my expections are wrong.
I didn't find much in the docs on how it is supposed to work exactly. So any help is appreciated.
I would also be able to write a plugin if that's how it can be done.

Kind regards
Thomas

Please Log in or Create an account to join the conversation.

  • Posts: 70022
  • Thank you received: 10486
  • MODERATOR
3 weeks 2 days ago #321085

Hi,

If you have the setting "Update the product stock on confirmed status" turned off, then the stock will only be decreased when an order is created.
And then, if you change its status to a cancelled status, it will give back the stock.
There is no mechanism in such case to decrease again the stock if you go from a cancelled status to the created status.

With that option turned off, the stock will only be decreased when an order goes from the "created" status to a confirmed status. And it will give it back if you go from a confirmed status to a cancelled status. So in that case, you can do full circles going:
created -> confirmed -> refunded -> created -> confirmed -> refunded -> created ...

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
  • Hikashop Business
3 weeks 1 day ago #321101

Thanks for the feedback. That's great!

Do you know what happens if the "created" status also has "confirmed" flag? Does that work as well? I mean does it test specific for "created" -> "confirmed" or doesn't it matter from which status you get to the "confirmed" one (eg does refunded -> confirmed work as well)?

> And it will give it back if you go from a confirmed status to a cancelled status.

Does that mean it will only decrease if I do directly from the "confirmed" status to a "cancelled" one? Or may there be other status used in between which don't have the "confirmed" flag (since that flag can only be set for one status).

I currently have the setting turned off.
From what I understood that should always give back the items once I get to a cancelled status, no matter what statuses are selected in between or afterwards. Which would work fine for us actually.

With this setting I still sometimes got weird results (not always). I'm not yet sure when it happens.

Please Log in or Create an account to join the conversation.

  • Posts: 70022
  • Thank you received: 10486
  • MODERATOR
3 weeks 1 day ago #321112

Hi,

It tests that the status is changed from the status selected under the "created" column of the order statuses menu to one of the statuses under the "invoice" column.
So from "refunded" to "confirmed" it won't do anything as it doesn't know what should be done. If you want to make it work, you need to do it in two steps: refunded->created->confirmed

If you go from confirmed to cancelled, it won't decrease the stock, it will increase it.
And that's not only that. From any status in the "invoice" column to any status in the "cancelled" column, it will increase (restore) it.

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
  • Hikashop Business
3 weeks 1 day ago #321141

Ah, that helps a lot. I missed the part that the Invoice column plays a role in stock management as well.
I see that there is a hint in the english tooltip about it, but it's missing in the german one. So that's probably why I didn't see it.

Thanks a lot for the explanations!

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum