Show variant stock level (for out of stock) in dropdown

  • Posts: 23
  • Thank you received: 3
  • Hikashop Business
1 week 22 hours ago #329824

-- HikaShop version -- : 4.4.0 Business
-- Joomla version -- : 3.9.24
-- PHP version -- : 7.4

Hi,
Is it possible to show the stock level of the variant before it is selected - for example - in the dropdown?
For example, the size XXL is out of stock but the customer won't know this before they have selected it - then are greeted with an out of stock notice - which may cause annoyance.
I know I could just unpublish that variant until I have stock available but I want to keep it active because I will be adding the notify button to the product page - and people might want to know that we can order more, if they request it.

ETA: I've posted this in the wrong forum, sorry. I don't think I can delete it or move it. I meant to post it in Product & Category Display.

Attachments:
Last edit: 1 week 22 hours ago by infinityb.

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

  • Posts: 3076
  • Thank you received: 395
  • MODERATOR
5 days 13 hours ago #329888

Hello,

So far in HikaShop there are no options to do that unfortunately... But it's always possible but via an override view ( Documentation ).
Now to be clear we can guide you to perform yourself this custom as usual, but this will require advanced knowledge in Html, Php AND HikaShop view.

Awaiting your returns to going more far on this subject.
Regards

Last edit: 5 days 13 hours ago by Philip.

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

  • Posts: 23
  • Thank you received: 3
  • Hikashop Business
4 days 11 hours ago #329950

Hi,
I have done some work with overrides and have very basic PHP knowledge but couldn't find the part I would need to change to add an extra word(s) in in this scenario. If you could advise what I would I would need to change that would be much appreciated.

Last edit: 4 days 11 hours ago by infinityb.

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

  • Posts: 72051
  • Thank you received: 10915
  • MODERATOR
4 days 4 hours ago #329958

Hi,

With HikaShop 4.4.1, that we've released last week, we've added the support of products with only one characteristic to the dynamic system that you can activate with the "Characteristics dynamic display" setting.
So update your HikaShop, make sure that this setting is configured to "always" and it should work like you want.
If it doesn't, it means that you have an override of show_block_characteristic.php based on an old version of Hikashop.

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

  • Posts: 23
  • Thank you received: 3
  • Hikashop Business
3 days 21 hours ago #329980

The 'characteristic dynamic display' option says it will remove the unavailable items from the list, which is not what I want to do.

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

  • Posts: 72051
  • Thank you received: 10915
  • MODERATOR
3 days 14 hours ago #329984

Hi,

Then there is no solution with the options available.
Either you have the out of stock variants removed from the list, or you have them.
And the stock is always displayed after the selection of the variant.
That's because if you have two characteristics, you can't display the stock until you've selected both dropdowns.
To change that, then you would be left with custom coding as philippe said. In the file show_block_characteristic.php try to add the code:

$value->characteristic_value.= ' ('.$variant->product_quantity.')';
before the code:
if($variant->product_quantity != 0){
This will add the stock of one of the variants for the value in the dropdown.
So it will work fine with one characteristic, but if you have products with more than one characteristic, it will display a quantity that shouldn't be there.

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

Time to create page: 0.066 seconds
Powered by Kunena Forum