Support » Plugin: WooCommerce » Order item meta no editable when adding variation via manual order

  • Resolved morris4ever69


    WP 4.9.2, WC 3.2.6, Adding manual order via backend

    T-Shirt | Color: red | Size: any

    When I add a variable product to a manual order and from the search box dropdown I choose a variation, if this product variation has an attribute set as “any”, the order item meta is added but is not visible in the manual order items box and I can’t edit this specific order item meta.

    If I retrieve all order item meta via php function or rest api, the item meta is there and empty. Of course I could add manually a new order item meta with the same slug and a value, but I will have a duplicate item meta (one empty and one manually added with its value): this is not the proper solution.

    Is this a bug?

Viewing 1 replies (of 1 total)
  • morris4ever69


    Some updates..

    In woocommerce/includes/class-wc-order-item.php file, line 253 (in get_formatted_meta_data function) there is the following if statement:

    if ( empty( $meta->id ) || '' === $meta->value || ! is_scalar( $meta->value ) || ( $hideprefix_length && substr( $meta->key, 0, $hideprefix_length ) === $hideprefix ) ) {

    The condition:

    '' === $meta->value

    hides the order item meta in admin edit order page so it’s not editable.

    I would propose something like this:

    ( !is_admin() && '' === $meta->value )

    but I’m not “super expert” and I would like to be sure that this change doesn’t create problems…

Viewing 1 replies (of 1 total)
  • The topic ‘Order item meta no editable when adding variation via manual order’ is closed to new replies.