Make first variant with stock selected

  • Posts: 17
  • Thank you received: 1
10 years 1 month ago #199398

-- HikaShop version -- : HikaShop Essential: 2.4.0

Hello.
I have a Hikashop shoes eshop and the only variants I have there are shoes sizes.
When someone enters the product page, I want to see all the sizes, but the ones that have no stock I make them disabled through html/css.
I have an overwrite of the file hikashop_characteristics.php in my template where I can control this.
But if the product has no stock in the first size, the page makes this as selected option.
I want the first available size with stock to be selected by default when someone enters the product page.
I can achieve that from the hikashop_characteristics.php file, but the checkout box below is not being displayed, because it is being probably calculated by the first size with no stock.
I would appreciate your help
Thanks
Dennis

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

  • Posts: 12953
  • Thank you received: 1778
10 years 1 month ago #199439

Hello Dennis,

When someone enters the product page, I want to see all the sizes, but the ones that have no stock I make them disabled through html/css.

The solution will probably just be to set the "Display out of stock products" to NO, then all your size will be available and a valid size will be selected by default.

Last edit: 10 years 1 month ago by Mohamed Thelji.

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

  • Posts: 17
  • Thank you received: 1
10 years 1 month ago #199471

Unfortunately I have to display them all. It is my client's request.

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

  • Posts: 83933
  • Thank you received: 13588
  • MODERATOR
10 years 1 month ago #199526

In that case, you'll have to add custom code in that hikashop_characteristics.php file you're talking about in your first message.
I suppose that you want to add custom javascript code to refresh the variants system:
window.hikashop.ready( function() {hikashopUpdateVariant(document.getElementById('ID'));});

where ID is to be replaced by the id of the select dropdown of your characteristic.

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

Time to create page: 0.068 seconds
Powered by Kunena Forum