I need to manipulate the data Woocommerce sends to PayPal in the 'Custom' Field. When Woocommerce creates the order and sends the data this can be found in
$order['custom']
This string is json encoded and I've got a filter I'm trying to use but it doesn't seem to be working. Here's what I've got:
add_filter('woocommerce_paypal_args', 'send_custom_paypal_data'); function send_custom_paypal_data($order) { error_log(print_r($order['custom'], true)); //log variable $order['custom'] = wp_json_encode( array( 'field1' => 'some value', 'field2' => 'more values' ) ); error_log(print_r($order['custom'], true)); //log value after updating variable return $order; }
The first time I dump the $order['custom']
variable to the error_log I get the expected value from the Woocommerce order. But the 2nd time around, it's the same value, nothing has changed.
没有评论:
发表评论