Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preenchimento de campos via API #194

Open
andremorganti opened this issue May 3, 2021 · 5 comments
Open

Preenchimento de campos via API #194

andremorganti opened this issue May 3, 2021 · 5 comments

Comments

@andremorganti
Copy link

Olá, estou fazendo a migração de um loja proprietária para o woocommerce, como consigo enviar os campos brasileiros como CPF, CNPJ entre outros via API?

Obrigado
André

@danilowm
Copy link

Aí é na API do próprio WP, vc fará a inserção nos campos criados por esse plugin normalmente

@fhferreira
Copy link

estou tentando enviar via META DATA mas sem sucesso.

billing_cpf
cpf
_billing_cpf

@fhferreira
Copy link

fhferreira commented Oct 12, 2021

$wc_data = [
'email' => '',
'first_name' => '',
'last_name' => '',
'username' => '',
'password' => 'texto plano',
'billing' => [
'first_name' => '',
'last_name' => '',
'company' => '',
'address_1' => '',
'address_2' => '',
'city' => '',
'state' => '',
'postcode' => '',
'country' => 'BR',
'email' => '',
'phone' => '',
],
'meta_data' => [
[
'key' => 'billing_persontype',
'value' => 2 // 2 = PF (CPF)
],
[
'key' => 'billing_cpf',
'value' => '00000000000',
],
[
'key' => '_billing_cpf',
'value' => '00000000000',
],
[
'key' => '_billing_persontype',
'value' => 2 // 2 = PF (CPF)
],
[
'key' => 'cpf',
'value' => '00000000000',
],
[
'id' => 3931,
'key' => 'billing_cpf',
'value' => '00000000000',
],
],
'shipping' => [
'first_name' => '',
'last_name' => '',
'company' => '',
'address_1' => '',
'address_2' => '',
'city' => '',
'state' => '',
'postcode' => '',
'country' => 'BR'
]
];
//print_r($woocommerce->post('customers', $wc_data));
$resp_woocommerce = $woocommerce->post('customers', $wc_data);

	tentei todos os formatos no meta_data mas continua sem exibir.

image
image

@danilowm
Copy link

danilowm commented Oct 13, 2021

tenta com o update_post_meta

update_post_meta($order->id, '_billing_cpf', '0000000');

@fhferreira
Copy link

fhferreira commented Oct 15, 2021

consegui via API @danilowm obrigado.

$order['meta_data'] = [['key' => '_billing_cpf', value = 'cpf']];

no endpoint /orders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants