-
AuthorPosts
-
March 6, 2016 at 5:16 pm #593949
i have a product with 2 varients, when i click add to cart without selecting a variation from the dropdown, i would like it to highlight the variation box in my theme main color asking for an option to first be selected to be able to add the product to cart.
March 6, 2016 at 9:40 pm #594004Hey arranch!
I have checked your web site and I can see that the product has always a Variation as first choice, if that is correct, what you need to achieve?
Regards,
BasilisMarch 7, 2016 at 12:37 am #594027this is only set for the moment as before there was no default value and when the visitor clicked on buy now, the product didn’t add to the cart and there was no message to inform them to choose a variation to make enable the product add to cart.
i’d like it to be set on no default, with a message to show when they try adding the product to the cart without choosing a variation from the dropdown.
March 9, 2016 at 9:38 am #595403Hi!
You can set a default variant and have it selected automatically on page load. Edit the product then go to the Variations panel. In the “Default Form Values:” you can set the default variations.UPDATE: My bad. I didn’t read the thread thoroughly. Let me get back to you after a while.
Cheers!
IsmaelMarch 9, 2016 at 9:50 am #595413Hey!
UPDATE: Please add this in the functions.php file:
// variant products add_action( 'wp_footer', 'ava_custom_script' ); function ava_custom_script() { ?> <script type="text/javascript"> (function($){ var a = function() { $('.av-woo-purchase-button').on('mouseover', function() { var sbutton = $('#top form.cart .button'); if(sbutton.attr('disabled') == "disabled") { $('#top .variations select').addClass('select-variant'); } else { $('#top .variations select').removeClass('select-variant'); } }); } a(); })(jQuery); </script> <?php }
And this code in the Quick CSS field:
.select-variant { border: 3px solid red; }
Best regards,
IsmaelMarch 9, 2016 at 10:57 am #595453thanks Ismael
i added this, but when i saved the functions.php file, i was shown a page that reads the following, relating to the attached line of your coding
March 15, 2016 at 6:05 am #598167Hey!
Looks like the characters are converted to something else. Please make sure that you copy the code directly from this forum and not from your email.
Regards,
IsmaelMarch 15, 2016 at 2:29 pm #598385I have now copied it across from the post and it accepts it, but it doesn’t show when i test it on my site. I’m wondering whether it’s because I added the product purchase button with the drag/drop avia layout builder from enfold, not the default WP editor.
March 17, 2016 at 2:36 am #599347Hi!
I checked it and the class attribute “select-variant” is being added correctly. Did you add the css code?
Best regards,
IsmaelMarch 17, 2016 at 3:20 am #599374yes i added this
March 17, 2016 at 5:52 am #599434 -
AuthorPosts
- You must be logged in to reply to this topic.