// Jednorazový skript na prekopírovanie starých telefónnych čísel z billing_phonee do _billing_phone add_action('init', function() { if ( ! current_user_can('manage_woocommerce') ) return; // len pre admina $args = [ 'limit' => -1, 'status' => 'any', ]; $orders = wc_get_orders( $args ); foreach ( $orders as $order ) { $order_id = $order->get_id(); $old_phone = get_post_meta( $order_id, 'billing_phonee', true ); $new_phone = get_post_meta( $order_id, '_billing_phone', true ); if ( ! empty($old_phone) && empty($new_phone) ) { update_post_meta( $order_id, '_billing_phone', sanitize_text_field($old_phone) ); } } echo '✅ Telefónne čísla z billing_phonee boli prekopírované do štandardného poľa WooCommerce.'; exit; }); // Ak máš vlastné pole napr. billing_phonee, ulož ho aj ako štandardné WooCommerce pole add_action('woocommerce_checkout_update_order_meta', function( $order_id ) { if ( isset($_POST['billing_phonee']) && ! empty($_POST['billing_phonee']) ) { update_post_meta( $order_id, '_billing_phone', sanitize_text_field($_POST['billing_phonee']) ); } });

Workshopy a vzdelávacie aktivity