Woocommerce order custom meta data from query vars

Lengkap Disiarkan 3 tahun lepas Dibayar semasa penghantaran
Lengkap Dibayar semasa penghantaran

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.

Wordpress PHP WooCommerce MySQL Mobile App Development

ID Projek: #29448450

Tentang projek

4 cadangan Projek jarak jauh Aktif 3 tahun lepas

Dianugerahkan kepada:

(11 Ulasan)
4.0

4 pekerja bebas membida secara purata $40 untuk pekerjaan ini

evgendob

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)
8.2
imTuyen

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)
6.0