Not sure why that works either. Try inspecting the result with a console.log() statement, like this:
$w.onReady(function(){
console.log(wixLocation.query);
$w('#orderNumber').value = wixLocation.query
})
You will see in the console, that wixLocation.query is an object, and not a string. It probably looks something like this:
{ "orderNumber": "12345" }
The value property of the #orderNumber element is a string. So, what you need is more like this:
$w.onReady(function(){
console.log(wixLocation.query.orderNumber);
$w('#orderNumber').value = wixLocation.query.orderNumber;
})
See the wix-location.query API for details.