Skip to content
This repository was archived by the owner on Feb 24, 2024. It is now read-only.

Nie ma opcji edycji w panelu admina #1

Open
goses opened this issue Apr 21, 2022 · 0 comments
Open

Nie ma opcji edycji w panelu admina #1

goses opened this issue Apr 21, 2022 · 0 comments

Comments

@goses
Copy link

goses commented Apr 21, 2022

Nie ma opcji edycji pola NIP w panelu admina, po kliknięciu Edytuj / "ołówka", lub przy utworzeniu nowego zamówienia,
mój kod który dodaje taką możliwość:

add_action('woocommerce_admin_order_data_after_billing_address', 'add_nip_to_billing_info', 10, 1);
function add_nip_to_billing_info($order)
{
	echo '<div class="address">';
    echo '<p><strong>' . __('NIP') . ':</strong> ' . (get_post_meta($order->id, 'nip', true) ? : 'brak') . '</p>';
	echo '</div>';
	echo '<div class="edit_address">';
	woocommerce_wp_text_input( array( 'id' => 'nip', 'label' => __( 'NIP' ), 'wrapper_class' => 'nip', 'value' => get_post_meta($order->id, 'nip', true)) );
	echo '</div>';
}

function admin_save_extra_details( $post_id, $post ){
    update_post_meta( $post_id, 'nip', wc_clean( $_POST[ 'nip' ] ) );
}
add_action( 'woocommerce_process_shop_order_meta', 'admin_save_extra_details', 45, 2 );
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant