Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #1457098

    Hi Teacher,

    Please how to change the product title when I choose an option ?

    Thanks

    #1457330

    Hey Aubin,
    You will need a addon to do this, see this documentation for this one. This article points to some other plugins and options.
    I found this code in this thread

    function custom_script() { ?>
      <script>
    jQuery( document ).ready( function( $ ) {
        var title_text = $( '.product-type-variable .product_title' ).text(); // get default title
        function add_variation_txt_to_title() {
            var new_title_text = '';
            $( '.variations select' ).each( function() {
                new_title_text += ' ' + $( this ).find( ':selected' ).val(); // collect all variation selected <options>
            })
            $( '.product-type-variable .product_title' ).text( title_text + new_title_text ); // set new title
        }
        add_variation_txt_to_title(); // call on load
        $( '.variations select' ).change( function() { // call on <select >change 
            add_variation_txt_to_title();
        })
    })
    </script>
      <?php
    }
    add_action( 'wp_footer', 'custom_script', 99 );

    and it sort of works on my test site:
    Enfold Support 6179
    Enfold Support 6177
    so give it a try. PLease note that not all plugins work with Enfold so you will need to test different plugin options to find one that works with your variable products the way you want.

    Best regards,
    Mike

    #1457346

    Thanks Mike.
    Please where to add this code in enfold child ?
    thanks

    #1457347

    I added this function in the enfold child function.php . But it doesn’t work .
    May I but this one ?
    Thanks

    #1457357

    Hi,
    The WooCommerce Products by Attributes & Variations looks like it has a variation title field
    Enfold Support 6187
    which would be the easiest way, but make sure that you ask them if you can try it first, because some addons don’t work properly with Enfold. Some plugins have a free version on WordPress Plugins so I would also check there.
    As for the script I posted above, my variation in my screenshot looks different that yours so perhaps that is a issue, and your site has a javascript error in your Simple Custom CSS and JS fore the search form, try disabling it and check again
    document.getElementsByClassName('search-form')[0].innerHTML += '<input type="hidden" name="post_type" value="product">';

    Best regards,
    Mike

    #1457380

    Thanks Mike for your support.
    variation

    For sure , We have a different variations products. Look my own above.
    “try disabling it and check again” How to do it please ?
    Where to put this code ?
    document.getElementsByClassName(‘search-form’)[0].innerHTML += ‘<input type=”hidden” name=”post_type” value=”product”>’;

    Last thing.
    I bought the “show-products-by-attributes-variations-web-package-1.5.1” this one . How can I install this addons on enfold child please ?

    Thanks,

    #1457384

    Hi,
    No I don’t mean add that code, your page has that javascript error, try disabling this code from your site, I think it is in your Simple Custom CSS and JS plugin.
    For the one you bought, you would install it as a plugin

    Best regards,
    Mike

    #1457389
    This reply has been marked as private.
    #1457391

    Hi,
    Perhaps you can post a admin login in the Private Content area so we can look.

    Best regards,
    Mike

    #1457393
    This reply has been marked as private.
    #1457394

    Hi,
    Thanks, now I see that you are using the ALB for the product with a text element for the title instead of the woocommerce title. Try creating a test product using the default editor and check.

    Best regards,
    Mike

    #1457395
    This reply has been marked as private.
    #1457397

    Hi,
    I tried to create one for you but didn’t get the variations correct, please see the link below and adjust the variations. Do not use the Advanced Layout Builder, only use the woocommerce product fields:
    Enfold Support 6199

    Best regards,
    Mike

    #1457401
    This reply has been marked as private.
    #1457403

    Hi,
    Ok, thank you, I see the Variation Title in the variation but it doesn’t seem to work on the frontend. I don’t see any errors that might point to a cause.
    I did find the script that I posted above was in your child theme style.css so I moved it to your child theme functions.php and it changes the product title when a variation is picked, so that is good news:
    Enfold Support 6201

    Best regards,
    Mike

    #1457404

    Hi,
    Thanks
    That’s means it is not possible to do it with Advanced Layout Builder.
    This is more complicated because all my website uses “Advanced Layout Builder”.
    It is not to use a code block in ALB ?

    Thanks

    #1457406
    This reply has been marked as private.
    #1457949

    Hi,
    The page that you linked to is not using the Enfold Advanced Layout Builder for the product, it is using the woocommerce product like in your test page, nonetheless I added some custom classes to your original /dji-mavic-3-classic/ product to try to get this to work.
    In this text element:
    Enfold Support 6203
    I added the custom class product-type-variable :
    Enfold Support 6205
    and in the title H1 tag I added the custom class product_title, note that you must use the “text tab to add the class:
    Enfold Support 6207
    and now it works:
    Enfold Support 6209
    You will need to manually change your other products like this.

    Best regards,
    Mike

    #1458540

    Thank very much
    Ok for all

Viewing 19 posts - 1 through 19 (of 19 total)
  • The topic ‘Changing title according’ is closed to new replies.