2017-07-10 5 views
0

カスタム商品タイプ「テスト製品」に「個別販売」フィールドを表示するにはどうすればよいですか? missing sold individuallyWooCommerceカスタム商品タイプインベントリタブに個別にフィールドがありません

私はあなたのfunction.phpファイルのコードの下に追加してください、次のフック関数

static function addField() { 
    echo "<script>jQuery('.show_if_simple').addClass('show_if_test'); 
    jQuery('._sold_individually_field.show_if_simple').addClass('show_if_test'); 
    </script>"; 
    } 
    add_action('woocommerce_product_options_general_product_data','addField')); 

答えて

1

てみました。あなたのクラスにshow_if_{your_custom_product_type}クラスを追加する必要があります。show_if_testになります。 show_if_simple_rentalshow_if_{your_custom_product_type}に置き換えてください。詳細についてはclick here

function wh_simple_rental_admin_custom_js() { 

    if ('product' != get_post_type()) : 
     return; 
    endif; 

    ?> 
    <script type='text/javascript'> 
     jQuery(document).ready(function() { 
      //for Inventory tab 
      jQuery('.inventory_options').addClass('show_if_simple_rental').show(); 

      jQuery('#inventory_product_data ._sold_individually_field').parent().addClass('show_if_simple_rental').show(); 
      jQuery('#inventory_product_data ._sold_individually_field').addClass('show_if_simple_rental').show(); 
     }); 
    </script> 
    <?php 

} 

add_action('admin_footer', 'wh_simple_rental_admin_custom_js'); 
関連する問題