• Resolved bastide.cl

    (@bastidecl)


    Hello,

    Firstable thank you for this plugin, works like a charm. I need to add the email from the shipping adress in the REST Api, after the phone if possible.

    I have this data right now :

    `shipping”: {
    “first_name”: “XXX”,
    “last_name”: “de XXX”,
    “company”: “”,
    “address_1”: “XXX”,
    “address_2”: “”,
    “city”: “XXX”,
    “state”: “”,
    “postcode”: “XXX”,
    “country”: “FR”,
    “phone”: “0668094338”
    },

    Can you tell me how to add a “email”: “[email protected]” please ?

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Plugin Author FAKTOR VIER

    (@faktorvier)

    Hi @bastidecl

    Sorry for the late answer. You can add the email to the REST API with the following hook:

    add_filter('woocommerce_rest_prepare_shop_order_object', function($response, $order, $request) {
    	$response->data['shipping']['email'] = get_post_meta($order->get_id(), '_shipping_email', true);
    	return $response;
    }, 10, 3);

    We plan to add this by default in a future release, but until then this hook should do the trick.

Viewing 1 replies (of 1 total)
  • The topic ‘Email in Shipping Line in REST API’ is closed to new replies.