다운로드 상품이 사이트에 필요하지 않은 경우, 옵션 선택 자체를 빼버리는 방법
/** * @snippet 다운로드 상품을 제거 */ add_filter( 'product_type_options', function( $options ) { // remove "Downloadable" checkbox if( isset( $options[ 'downloadable' ] ) ) { unset( $options[ 'downloadable' ] ); } return $options; } ); add_filter( 'woocommerce_products_admin_list_table_filters', function( $filters ) { if( isset( $filters[ 'product_type' ] ) ) { $filters[ 'product_type' ] = 'oks_product_type_callback'; } return $filters; }); function oks_product_type_callback(){ $current_type = isset( $_REQUEST[ 'product_type' ] ) ? wc_clean( wp_unslash( $_REQUEST[ 'product_type' ] ) ) : false; ?> <select name="product_type" id="dropdown_product_type"> <option value="">Filter by product type</option> <?php foreach( wc_get_product_types() as $value => $label ) : ?> <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $value, $current_type ) ?>> <?php echo esc_html( $label ) ?> </option> <?php endforeach; ?> </select> <?php } // add_action( 'add_meta_boxes', 'oks_remove_downloads_meta_box', 999 ); function oks_remove_downloads_meta_box(){ remove_meta_box( 'woocommerce-order-downloads', 'shop_order', 'normal' ); }