• Resolved Leo

    (@dekkydog)


    I am trying hide / unset the ‘Downloadable’ and ‘Virtual’ checkbox options from Woocommerce entirely. I have managed to unset them everywhere EXCEPT in the Woocommerce Variations Panel.

    Looking in the Woocommerce plugin files I can see an action hook called ‘woocommerce_variation_options’ which seems to spit out the options for these checkboxes. I can obviously do a “dirty” injection of CSS here but whats the correct method to unset these checkboxes in the variations product panel?

    I am looking for something like this:

    add_action( 'woocommerce_variation_options', 'my_customize_variation_fields_func', 10, 3 );
    function my_customize_variation_fields_func( $loop, $variation_data, $variation ){  
    // Remove / Unset "Virtual" checkbox
    // Remove / Unset "Downloadable" checkbox
    }

    I have tried using unset( $variation[ 'virtual' ] ); here but does not work as it has in another filter hook (product_type_options)? Any help / advice appreciated ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @dekkydog

    Thanks for reaching out!

    I understand that you would like to hide the Virtual and Downloadable checkboxes on the Products page, correct?

    I found the code snippet below from this article that worked on my site running on the default Storefront theme:

    add_filter( 'product_type_options', function( $options ) {
    	// remove "Virtual" checkbox
    	if( isset( $options[ 'virtual' ] ) ) {
    		unset( $options[ 'virtual' ] );
    	}
    	// remove "Downloadable" checkbox
    	if( isset( $options[ 'downloadable' ] ) ) {
    		unset( $options[ 'downloadable' ] );
    	}
    	return $options;
    } );

    Output:

    I trust this points you to the right direction, but if I am missing something here or did not understand what you’re trying to achieve, feel free to provide further information for us to address you more effectively.

    If a screenshot would be helpful, I’d recommend using https://snipboard.io or https://skitch.com/. You can share the direct link to the image as a response to this topic.

    Thanks!

    Thread Starter Leo

    (@dekkydog)

    Hi there, and thanks for the reply. Unfortunately thats not what I was looking for – I already have them hidden at that location. I am trying to hide these checkboxes here….

    Roxy

    (@roxannestoltz)

    Hi @dekkydog ,

    Kindly note that what you would like to achieve does require custom code, which is outside our scope of support.

    When researching on Google, there seems to be some potential customization solutions you could investigate within this Google search. Also, you can try searching on the www.remarpro.com plugin directory for something that may help you achieve this.

    Additionally, you can check out our developer level document on editing product data tabs, here.

    If you are still unable to find what you are looking for, you may need to consider hiring a developer to create a custom solution for this.

    For questions related to development and custom coding, your best bet is to ask on any of these channels for support. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, too.

    Cheers!

    Thread Starter Leo

    (@dekkydog)

    No Worries ?? I will just use the ‘Dirty Method’ to hide these items by injecting some CSS.

    Amir A. (woo-hc)

    (@amiralifarooq)

    Hi @dekkydog

    Glad to know you were able to get it sorted out, if you have any new questions, please create a new ticket.

    Cheers!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide ‘Downloadable’ and ‘Virtual’ checkbox options from Variations?’ is closed to new replies.