Woocommerce order custom meta data from query vars

Basically i need add to my Woocommerce order a custom meta (_device) and the value will be the result of the url loaded…

Please please read the full explanation and all that i test.

To test my dev server is needed change your local hosts.


Externally i load to my website a custom query variable on the URL. Example: [login to view URL]?origin=Android

Varibles: source=webview and origin=Android or origin=IOS

This variables let me know if the web is loaded from my webview app and what OS has the device (IOS or Android).

I try a lots of ways to get this work. One of this ways is trying to use $_GET like this example:

add_action('woocommerce_checkout_create_order', 'before_checkout_create_order3', 20, 2);

function before_checkout_create_order3( $order, $data ) {

$origen3 = $_GET['device'];

$order->update_meta_data( '_origen3', $origen3 );


But i can't save with php the Device and always have an empty value on my var.

Y also try with get_query_var and here i have two problems. When i try to save the variable with get_query_var like this:

$device = get_query_var( 'Device' );

I have an empty variable.

If i declare the query_var i have a redirection error. This is my example:

function test_query_vars( $qvars ) {

$qvars[] = 'device';

return $qvars;


add_filter( 'query_vars', 'test_query_vars' );

Here i think is something missing because i get the device saved but when i try to go to the home the page redirect to another page. I try re-save the permalinks and the .htaccess file but nothing works.

Kemahiran: Wordpress, PHP, WooCommerce, MySQL, Mobile App Development

Lihat lagi: access data query form, wordpress query posts order custom array, gravity forms create custom meta data, woocommerce get order meta data, woocommerce add custom field to order, woocommerce custom product data fields, woocommerce get meta data, add custom data to woocommerce order, woocommerce admin custom order fields, woocommerce add custom data to cart, add custom meta box in woocommerce product, woocommerce add custom field to order email, woocommerce order custom fields, woocommerce add custom field to order programmatically, woocommerce custom product search query, woocommerce add order item meta, add meta data to woocommerce product, woocommerce add custom field to order admin, woocommerce admin custom order fields nulled, woocommerce display custom fields on order page

Tentang Majikan:
( 21 ulasan ) Joyabaj, Guatemala

ID Projek: #29448450

Dianugerahkan kepada:

(11 Ulasan)

4 pekerja bebas membida secara purata $40 untuk pekerjaan ini


Hello. Wordpress development expert ready to help you with custom meta functionality. I have more 400 good reviews and more 9 years of development experience behind, so all will be done with best quality and timeframe. Lagi

$30 USD dalam sehari
(600 Ulasan)

Hello. I can do this project right now. I am a professional Linux and developer in PHP, Wordpress, Laravel, Magento, Joomla, Prestashop, OpenCart, Yii, NodeJS, Angular, Vue.js, HTML5, CSS3 and jQuery. I can do this pro Lagi

$30 USD dalam sehari
(71 Ulasan)

Hello! I'm Leonard from Wordpress Team and i can make this project very professional. How we can finish your project in time and perfect? The communication is very important! For quick reference here is some of the pr Lagi

$50 USD dalam sehari
(35 Ulasan)