Skip to content

Instantly share code, notes, and snippets.

@kilbot
Created June 5, 2025 15:43
Show Gist options
  • Save kilbot/8c2856ee590d1fc6abe1095ab742322a to your computer and use it in GitHub Desktop.
Save kilbot/8c2856ee590d1fc6abe1095ab742322a to your computer and use it in GitHub Desktop.
Migrate POS orders from Actuality Extensions
<?php
function wcpos_update_created_via_field() {
$batch_size = 100;
$page = 1;
do {
$orders = wc_get_orders( [
'limit' => $batch_size,
'page' => $page,
'type' => 'shop_order',
'status' => 'any',
'orderby' => 'ID',
'order' => 'ASC',
'return' => 'objects',
] );
foreach ( $orders as $order ) {
if ( $order->get_created_via() === 'pos' ) {
$order->set_created_via( 'woocommerce-pos' );
$order->save();
}
}
$page++;
} while ( count( $orders ) === $batch_size );
}
wcpos_update_created_via_field();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment