- Posts: 966
- Thank you received: 11
Hidden Variant Causing Issues
Say I have a Small, Medium and Large item.
If the Small is SOLD OUT, when the customer goes to the page, they see the SOLD OUT message without clicking on "Small". This is deceiving as it appears that all of that product is sold out. Please see the URL added in this post.
So what I usually do is create a default variant and add it as the first one, then use CSS to hide it to get rid of the issue stated above. See example attach.
If the user goes to the page and click "Add to Cart" without selecting a size, the DEFAULT variant is added to the cart.
How can I avoid getting the DEFAULT/(Hidden) variant added to the cart?
Thanks!
Please Log in or Create an account to join the conversation.
What you could do is to edit the file product / show.php via the menu display>Views and add a bit of code at the beginning to hide the add to cart button when the page is loaded:
Please Log in or Create an account to join the conversation.
So the code works perfectly for products that have variants but it does not work for products that do not have variants.
If you look at products in the "Preowned" section you will notice that the "Add to Cart" button is not showing because there is only one of each so I didn't have to use variants.
So maybe the code should be;
If there is variant hide the "Add to Cart" button until a selection is made, if no variant then don't hide it.
I will send the URL privately so you can see what I mean.
Thanks!
Please Log in or Create an account to join the conversation.
Then you just need an additional check around that code:
Please Log in or Create an account to join the conversation.
The website owner was saying that when the button is not visible customers may think that the product is out of stock. So she was asking if:
1) It's possible to disable the "add to cart" button and only enable it after they click on a size. Similar to what is done here:
www.roots.com/ca/en/cabin-slim-cuff-swea...emsourse=productlist
OR
2) Keep the button enabled/visible but display a message if they click on "add to cart" without selecting a size. Similar to what is done here:
www.gapcanada.ca/browse/product.do?pid=5...3_1#pdp-page-content
Thanks!
Please Log in or Create an account to join the conversation.
Both are possible with some more complex custom coding.
If you want us to work on this for you, you can use our contact form to request a quote:
www.hikashop.com/support/contact-us.html
Please Log in or Create an account to join the conversation.
I think the option to have customers select a variant in order to add an item to the cart should be part of Hikashop software without having to pay extra to have it added as it's not a unique customization, this should have been a default feature from the start - other ecommerce softwares has it as part of their software, and not an added feature, eg: j2store.net/demo/index.php/shop/simple
I also had to purchase other extensions in order to improve Hikashop's functionality so having to pay for other extensions, pay for hikashop software, pay for a feature that I think should already be part of the software, sadly for me, I cannot afford at this time.
Thanks!
Please Log in or Create an account to join the conversation.
That is already the case by default.the option to have customers select a variant in order to add an item to the cart should be part of Hikashop software without having to pay extra"
By default, the default variant is preselected. And thus, it is impossible to add a product to the cart without having a variant selected.
You changed the way it works to make it look like a variant isn't preselected and thus created that problem with the add to cart button being visible even though it's not a working one.
So having us fix that issue, which is specific to your website has to be an extra.
Now if instead you want us to add the capability to not have a variant preselected, we actually added that capability with the latest version with the "Characteristics dynamic display" setting. However, this works only when the product has more than 1 characteristic. And that's why I proposed another solution to do what you want here:
www.hikashop.com/forum/feature-request/9...-variant.html#322632
This would be possible without any coding (just a bit of CSS).
So basically there is one choice:
- you follow my advice and you're done with a bit of CSS and product / variant configuration
- you do it your way and it requires a bit of javascript coding
- you stay with the default system available and wait for us to implement some improvement to the system in the future
I'm not here to try to get more money from you. I'm proposing solutions that you can have directly on your website, without having to wait for us to improve HikaShop in the future. I actually gave you some simple code propositions but it seems you want something more complex to code. At that point it requires proper development, and thus money for the time spent.
Please Log in or Create an account to join the conversation.
Thanks!
Please Log in or Create an account to join the conversation.
No worries. But you didn't came back to me on this other thread where I provided a solution which should suit your needs:
www.hikashop.com/forum/feature-request/9...-variant.html#322632
Did you try it out ?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
After reading through your solution, although I prefer not to hide the "Add to Cart" button, I think I'll stick with the code that you provided for now and hopefully this improvement can be implemented to the system in the near future. It looks like, and I'm hoping, that with the code provided I don't have to add a HIDDEN default variant to the products anymore - that would save me some time
There seems to be some inconsistency with the products though, it works well with some products and not so well with others. I was trying to figure out why but I'm not seeing it.
I sent you a message with the URL of the products that works well and the ones that don't. Please let me know if there is something that I need to do differently when adding products or maybe the code needs some revisions.
Thanks I truly appreciate your help with this.
Please Log in or Create an account to join the conversation.
Just a word to say that if you provide your 2 url link via Pm directly to Nicolas, he is actually on vacations, if you want to advance your subject without having to wait for his return, and in general to send us information use our Contact us form.
And don't forget to add an Url link to this topic in your message.
Regards
Please Log in or Create an account to join the conversation.
I sent the email via the contact form.
Thanks!
Please Log in or Create an account to join the conversation.
Can you provide backend access via our Contact us form please, because so far we don't understand why there are variations from products to another.
Don't forget to add as usual an Url link to this topic.
Awaiting news from you to progress on your subject.
Regards
Please Log in or Create an account to join the conversation.
I sent the email. Thanks in advance for your help.
Please Log in or Create an account to join the conversation.
Everything is worked as expected, products that pre-selected a variant are just product which you didn't create a "select size/default" variants and define it as the default HikaShop default variant.
Note : Click to see picture details.
See the result in your product page, here
You have just to reproduce this idea for all your product.
Regards
Please Log in or Create an account to join the conversation.
I disagree. Unless I'm misunderstanding what you are saying.
If you look again at the 2 URLs that I sent in the email I explained that one has a default, like the example you provided above, and one does not. Yet the button is hidden for both of them on the details page.
I attached a photo of the two products for your information. Their URLs were sent in the email.
I would much prefer the option to NOT have to add a default.
Thanks!
Please Log in or Create an account to join the conversation.
Now, I get it and do the required modification to all your product follow me step by step :
1. In your product backend setting, Specifications part, I add this Characteristic that you create for this purpose
2. In your frontend Css file I add a custom css to hide the Characteristics in order to be clear on the frontend side.
Without huge custom, it's a little tricks and that can be perfect but it's seems to be close to your needs.
I let you test by yourself if it fit your needs.
Regards
Please Log in or Create an account to join the conversation.
Regarding Nicolas' solution below, how do I get the default characteristic to be selected automatically, so that the 2nd characteristic will show? As you can see, as per the attached image, it's not selected.
www.hikashop.com/forum/feature-request/9...-variant.html#322632
Please Log in or Create an account to join the conversation.