Support » Plugin: WooCommerce » Used for variants set to default (admin)

  • Resolved flexidesign


    I was made research by Google from this year to past 5 years. (also this forum)
    I was found only one solution – which now isn’t working after WooCommerce is in newer version.

    What i would like to?
    Simply i would like to have Default Ticked checkbox:”used for variants” after creating Attributes.

    Who can help me with this problem?
    I was saw that many people asked about this feature – but nobody knows how to fix this?

    Best Regards

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support wbrubaker


    Howdy 🙂

    Was this the solution that you were using:

    If not, you might want to give that a try.

    Thank you for this – i was try to use this before i was make this ticket.
    So – im not a programmer – and when i simpy copy this code:

    $( 'body' ).on( 'woocommerce_added_attribute', function( event ){
        $('.woocommerce_attribute_data .enable_variation').addClass('show_if_vp_extended').show();

    It isn’t work. I was read on begining that this guy was created custom variable: vp_extended .. i havent this.

    So could you tell me how i must modify this code to run it correctly in normal product mode? (i use: simply Prdocut with variations, choose earlier created attributes).

    Plugin Support wbrubaker


    That code is JavaScript and would somehow need to be included when viewing a product edit screen. The approach that I would recommend would be to create a plugin for this purpose. If you’re unfamiliar with how that is done, here is a good starting point:

    And a useful function for enqueueing JavaScript in WordPress:

    Plugin Support Jesse Pearson


    Automattic Happiness Engineer

    @flexidesign I went off of the previously mentioned Stack Overflow link and modified it to make sure it will check that box. This worked for me:

    function producttype_custom_js() {
    	if ( 'product' !== get_post_type() ) {
    	<script type='text/javascript'>
    		$( 'body' ).on( 'woocommerce_added_attribute', function( event ){
    			$( '.woocommerce_attribute_data .enable_variation .checkbox' ).prop( 'checked', true );
    add_action( 'admin_footer', 'producttype_custom_js' );  

    Here is an example of it working.

    Link to image:

    I am marking this thread as resolved, as this solution is working.

    Thank you for replay! 😀
    My programmer friend was made this easier 😀

    Simply add Custom Snippets plugin, and activate this code in backend:

    function always_true( $value ) {
        return 1;
    add_filter( 'woocommerce_attribute_default_is_variation', 'always_true' );

    Thanks anyway for script. I was forgot that i was create this ticket.
    Best of all

    Plugin Support Jesse Pearson


    Automattic Happiness Engineer

    @flexidesign Yes, I did not know about that filter. That would do it, as well. You can reduce the code to a single line:

    add_filter( 'woocommerce_attribute_default_is_variation', '__return_true' );
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Used for variants set to default (admin)’ is closed to new replies.