• Resolved datadanio

    (@datadanio)


    I would like to add the membership ID in the “new order” email sent automatically from woocommerce.
    This is the code in the email_header:

    $orderID = explode("#", $email_heading); 
                                $order = new WC_Order($orderID[1]);
                                $user = get_user_by( 'email', $order->get_billing_email());
                                $memberships = wc_memberships_get_user_active_memberships($user->ID);
                                foreach ( $memberships as $v ) {
                                    $member = (array) $v;
                                }
                                $orderN = explode('_', $member['plan']->name);
                                $ordine = $orderN[1];
                                $output = 'Codice cliente: '.$ordine.'<br>';

    I have tried several different things according to woocommerce memberships documentation. However I can’t display the memberships user id.
    The problem seems to be at wc_memberships_get_user_active_memberships($user->ID);, but I can’t be sure as everything I have tried displayed blank.

    Any help on that? thank you!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Woocommerce Memberships Extract Memberships ID’ is closed to new replies.