6 votes Vote It would be very useful to set up an option: possibility to change the title to variation title according variation selection. Under Review Category: Show Single Variations stotzbalazs shared this idea Add this to functions.php to set titles on variation change // Save the titles for the variations in an object var titles = new Object(); titles[‘0’] = ‘get_title(); ?>’; get_available_variations(); foreach ($variations as $key => $variation) { ?> titles[“”] = ”; jQuery(document).ready(function($) { // If we start with a variation in the address bar set the title if ($(‘input.variation_id’).val() > 0) { $(‘.product_title.entry-title’).html(titles[$(‘input.variation_id’).val()]); } $(‘input.variation_id’).change(function() { // Change the title on variable product when variation changes var var_id = $(‘input.variation_id’).val(); if (” != var_id) { $(‘.product_title.entry-title’).html(titles[var_id]); } }); $(“.variations_form”).on(“reset_data”, function() { $(‘.product_title.entry-title’).html(titles[‘0’]); }); }); <?PHP } Reply It messed up my post. Let me try again // Save the titles for the variations in an object var titles = new Object(); titles['0'] = 'get_title(); ?>'; get_available_variations(); foreach ($variations as $key => $variation) { ?> titles[""] = ''; jQuery(document).ready(function($) { // If we start with a variation in the address bar set the title if ($('input.variation_id').val() > 0) { $('.product_title.entry-title').html(titles[$('input.variation_id').val()]); } $('input.variation_id').change(function() { // Change the title on variable product when variation changes var var_id = $('input.variation_id').val(); if ('' != var_id) { $('.product_title.entry-title').html(titles[var_id]); } }); $(".variations_form").on("reset_data", function() { $('.product_title.entry-title').html(titles['0']); }); }); <?PHP } Reply It keeps messing up my code. Please find the code here to do this. https://pastebin.com/WMnc4Ch4 Reply Hi. Could you put the code back on pastebin… so we can try. Thanks Reply hi I tried but I get this code syntax error, unexpected ‘var’ (T_VAR), expecting end of file. I’m interested in this feature Reply Hi. We would like to request this type of feature also. It would be very helpful. Thanks Frank Reply ← All Requests Don't have an account? Register Already have an account? Login Username Email / Username Password Repeat Password Login Register Top Requests Dokan multivendor support for pickup and delivery slots 25 Votes Select delivery date and time slot visibility by product category 20 Votes Different angles 17 Votes Integration with WooCommerce Subscriptions 16 Votes Let the customer input their own text 13 Votes Categories Account Pages Attribute Swatches Bundled Products Custom Fields for Variations Delivery Slots Flux Checkout General Image Swap Linked Variations Product Configurator Quickview Sales Booster Show Single Variations Wishlists WooThumbs
6 votes Vote It would be very useful to set up an option: possibility to change the title to variation title according variation selection. Under Review Category: Show Single Variations stotzbalazs shared this idea Add this to functions.php to set titles on variation change // Save the titles for the variations in an object var titles = new Object(); titles[‘0’] = ‘get_title(); ?>’; get_available_variations(); foreach ($variations as $key => $variation) { ?> titles[“”] = ”; jQuery(document).ready(function($) { // If we start with a variation in the address bar set the title if ($(‘input.variation_id’).val() > 0) { $(‘.product_title.entry-title’).html(titles[$(‘input.variation_id’).val()]); } $(‘input.variation_id’).change(function() { // Change the title on variable product when variation changes var var_id = $(‘input.variation_id’).val(); if (” != var_id) { $(‘.product_title.entry-title’).html(titles[var_id]); } }); $(“.variations_form”).on(“reset_data”, function() { $(‘.product_title.entry-title’).html(titles[‘0’]); }); }); <?PHP } Reply It messed up my post. Let me try again // Save the titles for the variations in an object var titles = new Object(); titles['0'] = 'get_title(); ?>'; get_available_variations(); foreach ($variations as $key => $variation) { ?> titles[""] = ''; jQuery(document).ready(function($) { // If we start with a variation in the address bar set the title if ($('input.variation_id').val() > 0) { $('.product_title.entry-title').html(titles[$('input.variation_id').val()]); } $('input.variation_id').change(function() { // Change the title on variable product when variation changes var var_id = $('input.variation_id').val(); if ('' != var_id) { $('.product_title.entry-title').html(titles[var_id]); } }); $(".variations_form").on("reset_data", function() { $('.product_title.entry-title').html(titles['0']); }); }); <?PHP } Reply It keeps messing up my code. Please find the code here to do this. https://pastebin.com/WMnc4Ch4 Reply Hi. Could you put the code back on pastebin… so we can try. Thanks Reply hi I tried but I get this code syntax error, unexpected ‘var’ (T_VAR), expecting end of file. I’m interested in this feature Reply Hi. We would like to request this type of feature also. It would be very helpful. Thanks Frank Reply
Add this to functions.php to set titles on variation change // Save the titles for the variations in an object var titles = new Object(); titles[‘0’] = ‘get_title(); ?>’; get_available_variations(); foreach ($variations as $key => $variation) { ?> titles[“”] = ”; jQuery(document).ready(function($) { // If we start with a variation in the address bar set the title if ($(‘input.variation_id’).val() > 0) { $(‘.product_title.entry-title’).html(titles[$(‘input.variation_id’).val()]); } $(‘input.variation_id’).change(function() { // Change the title on variable product when variation changes var var_id = $(‘input.variation_id’).val(); if (” != var_id) { $(‘.product_title.entry-title’).html(titles[var_id]); } }); $(“.variations_form”).on(“reset_data”, function() { $(‘.product_title.entry-title’).html(titles[‘0’]); }); }); <?PHP } Reply
It messed up my post. Let me try again // Save the titles for the variations in an object var titles = new Object(); titles['0'] = 'get_title(); ?>'; get_available_variations(); foreach ($variations as $key => $variation) { ?> titles[""] = ''; jQuery(document).ready(function($) { // If we start with a variation in the address bar set the title if ($('input.variation_id').val() > 0) { $('.product_title.entry-title').html(titles[$('input.variation_id').val()]); } $('input.variation_id').change(function() { // Change the title on variable product when variation changes var var_id = $('input.variation_id').val(); if ('' != var_id) { $('.product_title.entry-title').html(titles[var_id]); } }); $(".variations_form").on("reset_data", function() { $('.product_title.entry-title').html(titles['0']); }); }); <?PHP } Reply
It keeps messing up my code. Please find the code here to do this. https://pastebin.com/WMnc4Ch4 Reply
hi I tried but I get this code syntax error, unexpected ‘var’ (T_VAR), expecting end of file. I’m interested in this feature Reply