• Resolved stevecurrey

    (@stevecurrey)


    Hi all,

    We have the paid version of WP slice.

    I am currently attempting to get it working with a “Share Cart” module.

    So far, I can ascertain whether the user has the role “affiliate” and if so, I would need to append the affiliate ID to the share cart link.

    How do I get the affiliate ID for the logged in user starting with:

    $user = wp_get_current_user();

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter stevecurrey

    (@stevecurrey)

    I’ve answered it myself:

    $affiliate = slicewp_get_affiliate_by_user_id( $user->id );
    $affiliate_id = $affiliate->get( ‘id’ );

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @stevecurrey,

    Your approach is good and will work nicely. Even so, as an alternative, we have a dedicated function for this particular scenario:

    $affiliate_id = slicewp_get_current_affiliate_id();

    The function will return a positive integer if the current user is logged in and is an affiliate, or 0 (zero) otherwise.

    Best wishes,
    Mihai

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get Affiliate ID’ is closed to new replies.