• I have a problem with the plugin.
    It works fine with
    Product data>simple product
    But with
    Product data>variable product
    The general tab disappears so I can’t input into notes.

    I really need this to work for variable products Because most of my products use this type of data.
    Is it possible to move the note function to another tab? for example advanced tab?
    I understand it would be a custom job and I would be happy to donate to the project. Just let me know if you be willing to do it. Thanks a lot.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter shaunrico

    (@shaunrico)

    It’s ok now, I figured it out myself by editing the code.
    Had some help from here to see the hook for advanced tab:
    https://woocommerce.wp-a2z.org/oik_letters/w/page/13/?post_type=oik_hook

    I think it’s better to move it to advanced tab because now your admin notes is present in all product modes.

    i need this to work for variable products as well. any possibility of an update?

    @shaunrico any chance you could help me out with the code changes you made to get this to work with variable products?

    Thread Starter shaunrico

    (@shaunrico)

    just extract the plugin zip file and edit products-admin-notes-simple.php
    And replace with this code:

    <?php
    
    // Display Fields
    add_action( 'woocommerce_product_options_advanced', 'pans_woo_add_custom_advanced_fields' );
    
    // Save Fields
    add_action( 'woocommerce_process_product_meta', 'pans_woo_add_custom_advanced_fields_save' );
    
    function pans_woo_add_custom_advanced_fields() {
      global $woocommerce, $post;
    
      echo '<div class="pans_ta_options_group">';
      // Textarea
      woocommerce_wp_textarea_input(
      	array(
      		'id'          => '_pans_ta',
      		'label'       => __( 'Admin notes', 'woocommerce' ),
      		'placeholder' => 'These notes are visible to admins only.',
      	)
      );
      echo '</div>';
    }
    
    function pans_woo_add_custom_advanced_fields_save( $post_id ){
      // Textarea
      	$woocommerce_textarea = $_POST['_pans_ta'];
      	if( !empty( $woocommerce_textarea ) )
      		update_post_meta( $post_id, '_pans_ta', sanitize_textarea_field( $woocommerce_textarea ) );
    
    }
    ?>
    
    Plugin Author jamiehall16

    (@jamiehall16)

    Hi Shaun,

    Thanks for the help I’ll add this in the next update and also add you as a contributor.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘General tab disappears’ is closed to new replies.