Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'after_wcfm_products_manage_grouped', function($product_id, $product_type) {
- global $WCFM;
- $cpt = wcfm_get_post_meta( $product_id, 'dummy_field', true);
- ?>
- <!-- collapsible 2.x - Custom Product Tab -->
- <div class="page_collapsible products_manage_cpt cpt simple variable grouped external" id="wcfm_products_manage_form_cpt_head"><label class="wcfmfa fa-object-group"></label><?php _e('Custom Product Tab', 'wc-frontend-manager'); ?><span></span></div>
- <div class="wcfm-container cpt simple variable grouped external">
- <div id="wcfm_products_manage_form_cpt_expander" class="wcfm-content">
- <?php
- $WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'product_manage_fields_grouped', array(
- "dummy_field" => array('label' => __('Dummy Field', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele simple variable booking', 'label_class' => 'wcfm_title', 'value' => $cpt, 'placeholder' => __('Custom field value', 'wc-frontend-manager'), 'hints' => __( 'This is a custom hint.', 'wc-frontend-manager' ))
- ), $product_id ) );
- ?>
- </div>
- </div>
- <!-- end collapsible -->
- <?php
- }, 10, 2 );
- add_action( 'after_wcfm_products_manage_meta_save', function($product_id, $form_data) {
- if( isset( $form_data['dummy_field'] ) ) {
- wcfm_update_post_meta( $product_id, 'dummy_field', sanitize_text_field( $form_data['dummy_field'] ) );
- }
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement