vendredi 3 juin 2016

How do I get the checkout fields inside woocommerce_payment_complete action?

I want to trigger sending another custom email with the checkout fields when the order is completed. How do I access the checkout fields inside woocommerce_payment_complete?

Or is there some other action I should use?

add_action( 'woocommerce_payment_complete','new_email_notification' );
function new_email_notification($order_id) {

    global $woocommerce;
    $checkout = $woocommerce->checkout();
    $order = new WC_Order( $order_id );
    $myuser_id = (int)$order->user_id;
    $user_info = get_userdata($myuser_id);
    $items = $order->get_items();
    foreach ($items as $item) {
    ...

I'm able to get the order information but not the checkout fields.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire