add_action( 'woocommerce_product_options_general_product_data', 'add_crowdfunding_custom_fields' );
function add_crowdfunding_custom_fields() {
global $woocommerce, $post;
$prefix = 'wp_cf_';
echo '
';
// ●クラウドファンディング プロジェクト商品にする□(チェックボックス)
woocommerce_wp_checkbox( array(
'id' => $prefix . 'enabled',
'label' => 'クラウドファンディング プロジェクト商品にする',
'description' => 'チェックを入れるとクラウドファンディング商品になります。',
'desc_tip' => true,
) );
// ●必須:All or Nothing型・All In型(チェックボックスで選択必須)
// ※チェックボックスだが必須なので実質ラジオの代替。実装上は複数チェックは不可にJS等で制御推奨
echo '
';
woocommerce_wp_checkbox( array(
'id' => $prefix . 'all_or_nothing',
'label' => 'All or Nothing型(目標金額未達で獲得金一切なし)',
'description' => 'All or Nothing型(目標金額未達で獲得金一切なし)とAll In型(目標金額未達でも獲得した分の獲得金を得られる)のどちらかを選択してください。',
'desc_tip' => true,
) );
woocommerce_wp_checkbox( array(
'id' => $prefix . 'all_in',
'label' => 'All In型(目標金額未達でも獲得した分の獲得金を得られる)',
'description' => 'All or Nothing型(目標金額未達で獲得金一切なし)とAll In型(目標金額未達でも獲得した分の獲得金を得られる)のどちらかを選択してください。',
'desc_tip' => true,
) );
echo '
';
// (meta-no-1) ●必須:目標金額
woocommerce_wp_text_input( array(
'id' => $prefix . 'goal',
'label' => '必須:目標金額',
'type' => 'number',
'custom_attributes' => array( 'step' => '1', 'min' => '0' ),
'description' => 'プロジェクトの目標金額を入力してください。',
'desc_tip' => true,
) );
// (meta-no-2) ●必須:最低支援金額
woocommerce_wp_text_input( array(
'id' => $prefix . 'min_support',
'label' => '必須:最低支援金額',
'type' => 'number',
'custom_attributes' => array( 'step' => '1', 'min' => '0' ),
'description' => 'プロジェクトの最低支援金額を入力してください。',
'desc_tip' => true,
) );
// (meta-no-3) ●必須:追加支援金額
woocommerce_wp_text_input( array(
'id' => $prefix . 'step',
'label' => '必須:追加支援金額',
'type' => 'number',
'custom_attributes' => array( 'step' => '1', 'min' => '0' ),
'description' => 'プロジェクトの追加支援金額(増減選択可動範囲)を入力してください。',
'desc_tip' => true,
) );
// (meta-no-4) ●任意:期限(設けない場合は空白)
woocommerce_wp_text_input( array(
'id' => $prefix . 'deadline',
'label' => '任意:期限(設けない場合は空白)',
'type' => 'date',
'description' => '支援期限を設定してください。設けない場合は空白のままにしてください。',
'desc_tip' => true,
) );
// (meta-no-5) ●任意:リターンアイテムカテゴリーID (カンマ区切り)
woocommerce_wp_text_input( array(
'id' => $prefix . 'return_cat_ids',
'label' => '任意:リターンアイテムカテゴリーID (カンマ区切り)',
'description' => 'このプロジェクトに紐付くリターンアイテムカテゴリーIDを入力してください。複数設定する場合はカンマ区切りで入力してください(例:「111,123,333」)。ない場合は何も入力しないでください。',
'desc_tip' => true,
) );
// (meta-no-6) ●任意:リターンアイテムID (カンマ区切り)
woocommerce_wp_text_input( array(
'id' => $prefix . 'return_item_ids',
'label' => '任意:リターンアイテムID (カンマ区切り)',
'description' => 'このプロジェクトに紐付くリターンアイテムIDを入力してください。複数設定する場合はカンマ区切りで入力してください(例:「111,123,333」)。ない場合は何も入力しないでください。',
'desc_tip' => true,
) );
// (meta-no-7) ●任意:活動報告記事カテゴリーID (カンマ区切り)
woocommerce_wp_text_input( array(
'id' => $prefix . 'report_cat_ids',
'label' => '任意:活動報告記事カテゴリーID (カンマ区切り)',
'description' => 'このプロジェクトに紐付く活動報告記事カテゴリーIDを入力してください。複数設定する場合はカンマ区切りで入力してください(例:「111,123,333」)。ない場合は何も入力しないでください。',
'desc_tip' => true,
) );
// (meta-no-8) ●任意:活動報告記事ID (カンマ区切り)
woocommerce_wp_text_input( array(
'id' => $prefix . 'report_post_ids',
'label' => '任意:活動報告記事ID (カンマ区切り)',
'description' => 'このプロジェクトに紐付く活動報告記事IDを入力してください。複数設定する場合はカンマ区切りで入力してください(例:「111,123,333」)。ない場合は何も入力しないでください。',
'desc_tip' => true,
) );
// (meta-no-9) ●任意:支援者一覧を表示する□(チェックボックス)
woocommerce_wp_checkbox( array(
'id' => $prefix . 'show_supporters',
'label' => '支援者一覧を表示する',
'description' => 'チェックを入れるとメッセージを含む支援者一覧を表示できます。',
'desc_tip' => true,
) );
echo '
';
}
レビュー
レビューはまだありません。