pablorsa
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Sorry, did not see the option.
Clear on Reselect – Clear selected attribute on select again
I can confirm this error had been fixed.
I did some code to do what I wanted and that is to place the product image on the swatch image, however the update messed that up as there is no more IMG tag with the fallback 🙁
I have since changed code to correct it and hopefully works for future updates. If anyone wanted it. (Still learning WP)
This also uses a custom field in variations called title which can be found ” https://www.businessbloomer.com/woocommerce-add-custom-field-product-variation/ ”add_action( 'woocommerce_after_variations_form', 'wvs_modifications', 20 ); function wvs_modifications() { if ( class_exists( 'Woo_Variation_Swatches', false ) ) { if ( is_product()){ ?> <script> /* WVS Title and Image Hack */ jQuery(document).ready(function($) { $(".variations_form .image-variable-items-wrapper").each(function(e) { var jArray = $('.variations_form').data('product_variations'); for (var obj = 0; obj < jArray.length; obj++) { var variation = jArray[obj]['attributes'][$(this).data('attribute_name')]; if ($('[data-value="' + variation + '"]')) { var title = (jArray[obj]['title']) ? jArray[obj]['title'] : '' ; $('.variations_form li[data-value="' + variation + '"]').find('div').html('<img src="' + jArray[obj]['image']['gallery_thumbnail_src'] + '" alt="' + title + '" title="' + title + '" width="50" height="50">'); if (title.length > 0) { $('.variations_form li[data-value="' + variation + '"]').attr('data-title', title).attr('data-wvstooltip', title); } } } }); }); </script> <?php } } return false; }- This reply was modified 3 years, 9 months ago by pablorsa.
Viewing 2 replies - 1 through 2 (of 2 total)