Closed fabianomoier closed 6 years ago
Before using getRequest
or getResponse
you'll need to send a request to your Woocommerce Store
use Woocommerce;
// first send a request
Woocommerce::get('orders');
// get the request
Woocommerce::getRequest();
// get the response headers
Woocommerce::getResponse();
good afternoon!! I was able to capture Json with php: // input was as below !! $ raw = file_get_contents ("php: // input"); $ data = json_decode ($ raw, true);
I have no idea what you're trying to achieve :-(
Sorry I created the WebHook to send the orders to my route and in my Controller I needed to receive the Json the way I got was that down !!
$ raw = file_get_contents ("php: // input"); $ data = json_decode ($ raw, true);
OK. Just let me know if anything is missing from the documentation so I can add it.
Hello, I am now trying to get the requests through WebHooks, and add in my DB, but unfortunately I am ramping on something, to get the json information received I use Woocommerce :: getRequest (); I just sent a request with Webhook and the fields were left with nothing
Here's how I'm doing
// Busca as Ordens no Woo $raw = Woocommerce::getRequest(); $dados = json_decode($raw, true); $nr_pedido = $dados['number']; $params_pedidos = [ 'nr_pedido' => $dados['number'], 'cgc_cpf' => substr($dados['billing']['cpf'], 0, 14), 'forma_pagto' => substr($dados['payment_method_title'], 0, 15), 'vl_mercadorias' => $dados['total'] - $dados['shipping_total'], 'vl_frete' => $dados['shipping_total'], 'vl_pedido' => $dados['total'],
];
//after all combined we send to database table Ecommercepedidos::firstOrCreate($params_pedidos);