Home Forums WoodMart support forum enable the virtual option in variable products

enable the virtual option in variable products

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #268774

    nickop
    Participant

    Hello, i try to enable the virtual option to be checked to all variable products.
    I try to use the following snippet but not working:
    add_action( ‘woocommerce_product_options_general_product_data’, ‘enable_virtual_option’ );
    function enable_virtual_option(){
    global $post, $woocommerce, $product, $product_object;

    if ( $product_object->is_type(‘variable’) ){
    ?>
    <script>
    (function($){
    $(‘input[name=_virtual]’).prop(‘checked’, true);
    })(jQuery);
    </script>

    <?php
    }
    }
    Can you suggest me a solution please?
    Thanks!

    #268883

    Hello,

    This code would not fit the variable product.

    Unfortunately, we do not have a solution to implement your purpose.

    Best Regards

Viewing 2 posts - 1 through 2 (of 2 total)