Support » Plugin: WooCommerce » Adding a new product… maybe a bug

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    It comes back for me.

    What plugin is adding those fields to your general tab? Might be related.

    Thread Starter MaBecker

    (@mabecker)

    add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
    add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
    
    function woo_add_custom_general_fields() {
    
    global $woocommerce, $post;
    // Text Field
    woocommerce_wp_textarea_input(
    array(
    'id' => 'salescompany',
    'label' => __( 'Sales Company', 'woocommerce' ),
    'placeholder' => 'Adress here',
    'desc_tip' => 'true',
    'description' => __( 'Sales Company Adress here', 'woocommerce' )
    )
    );
    woocommerce_wp_textarea_input(
    array(
    'id' => 'nddshortdescription',
    'label' => __( 'Short-Description', 'woocommerce' ),
    'placeholder' => 'Enter some short info',
    'desc_tip' => 'true',
    'description' => __( 'Short description for the small view in cart and email', 'woocommerce' )
    )
    );
    }
    function woo_add_custom_general_fields_save( $post_id ){
    	$nddselleradress = $_POST['salescompany'];
    	if( isset( $nddselleradress ) )
    	update_post_meta( $post_id, 'salescompany', esc_attr( $nddselleradress ) );
    	$nddshortdesc = $_POST['nddshortdescription'];
    	if( isset( $nddshortdesc ) )
    	update_post_meta( $post_id, 'nddshortdescription', esc_attr( $nddshortdesc ) );
    }
    Thread Starter MaBecker

    (@mabecker)

    i guess i did something wrong. i seeped some unused terms, maybe this is the problem?

    Unused Terms
    Note that some unused terms might belong to draft posts that have not been published yet. Only sweep this when you do not have any draft posts.

    grouped
    variable
    external

    if so, is there any way to add them again.

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    The code doesn’t seem to affect it. Are there any other customisations here?

    Thread Starter MaBecker

    (@mabecker)

    hmm, nothing which was changed since i updated.
    i just build two new products (1 grouped, 1 variable)

    now the switching works again. is it correct, that the SKU field is now based in inventory?

    Thread Starter MaBecker

    (@mabecker)

    i deleted unused terms with wp-sweep.

    Unused Terms
    Note that some unused terms might belong to draft posts that have not been published yet. Only sweep this when you do not have any draft posts.

    grouped
    variable
    external

    did test it again and can confirm now that if the terms are deleted it leads to the behaviour you can see on my screenshots.

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Yes it would. Those terms should be left alone – they need to exist, thats why we create them on install.

    Thread Starter MaBecker

    (@mabecker)

    yes, i’m fine with this, but people maybe need to clean up sometimes their db and it would be good to know that espeacially those should not be touched. other people could run into the same situation.
    cheers

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    I don’t think there is a way to prevent deletion but I’ll see if we can add a workaround.

    Thread Starter MaBecker

    (@mabecker)

    thanks for your answer. marked this as resolved 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Adding a new product… maybe a bug’ is closed to new replies.