Admin order entry - control quantity

  • Posts: 3
  • Thank you received: 0
  • Hikashop Business
7 months 3 weeks ago #360084

-- HikaShop version -- : 5.0.3
-- Joomla version -- : 5.0.3

if the admin enters orders in the backoffice, hikashop won't check if there is enough stock.
So more items can be entered into an order than are actually in stock and that causes discrepancies in the stock administration.

How can this check be done before an item is added to an order.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 months 3 weeks ago #360085

Hi,

Indeed. In the backend, you can overrule what is allowed on the frontend.
There is no setting to allow for that check.
I think the best would be to develop a plugin to handle this check. HikaShop has a specific event called onBeforeOrderProductsUpdate(&$order, &$do) which is called when new products are added to an order.
So, by implementing this event in a hikashop plugin, you could use it to check if the stock of the product being added is enough, and if not, set $do to false in order to cancel adding the product to the order.
So it would require a bit of development. And it could actually become quite complex if you want to be able to handle all the subtleties of HikaShop (for example, products can have variants, and the stock can be managed per variant, or globally in the main product. Also, products can also have bundled products, and the stock of the bundled products should also be taken into account. Or you also have the "preorder" plugin on our marketplace, which allows you to order more than the available stock, up to a point), but maybe you don't need to handle all of this and thus it would be quite easy for any PHP developer to work on a simple version.

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

Time to create page: 0.052 seconds
Powered by Kunena Forum