• Resolved svtmontagna

    (@montino)


    Hello,
    Is it possible to see the number of users who purchase products through an affiliate?
    E.g.
    5 out of 10 people buy my product through an affiliate and I can see a dashboard where 5 people bought through that affiliate.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hello,

    Good afternoon. I trust you are well and safe!

    Yes, it is possible to see the number of referrals made by each affiliate. To view these stats please navigate to Affiliates > Affiliates & Referrals. Furthermore, you can also view all the referrals made by an affiliate by navigating to Affiliates > Referrals and filtering by the desired affiliate.

    You can read more on this here:
    * https://docs.itthinx.com/document/affiliates/affiliate-program-management/managing-referrals/

    Stay safe and be awesome!
    Best,
    Eugen.

    Thread Starter svtmontagna

    (@montino)

    Hi,
    I’m trying to test this plugin but no accepeted refferal is appearing. Maybe because I’m buying through a plugin that allow me to bypass payment for testing purposes?

    Hi,

    Good afternoon and happy mid-week.

    Thank you for the update on this.

    If you are using WooCommerce for your shop, then please ensure you install the free Affiliates integration plugin; Affiliates WooCommerce Light.

    With this integration plugin, referrals are created automatically for your affiliates when sales are made.

    It also allows you to set a referral (commission) rate, so that your affiliates get credited with a referral, based on a percentage of each sale’s total net amount.

    Furthermore, perhaps you could also check the order status, if it is not Completed or Processing, you can manually edit the order and change the order status to reflect either Completed or Processing.

    You can read more here

    Stay safe and be awesome!
    Best,
    Eugen.

    Thread Starter svtmontagna

    (@montino)

    Hello and thanks for your answer,
    I have already installed Affiliates WooCommerce Light. I have not set any percentage because I just want to know the number of people who bought through that affiliate and then solve it in person with him (it’s a very local thing at the moment). The product is digital, so the order is immediately placed in the “completed” status. However, after I buy that product I can see the clicks but any references.

    Thread Starter svtmontagna

    (@montino)

    I confirm it works now. I was buying as affiliate before. I tried to buy a product without affiliate role and it worked. Is it possible to add affiliate dashboard on woocommerce user dashboard?

    Thread Starter svtmontagna

    (@montino)

    I did it through PHP. Thanks for all, my problem is solved.

    Plugin Author Kento

    (@proaktion)

    @montino I’m curious to know how you did it … did you render the [affiliates_dashboard] shortcode in one of the templates?

    Thread Starter svtmontagna

    (@montino)

    Hello,
    I’m happy to share my solution with you. I found a snippet online to add a tab inside woocommerce dashboard and show a shortcode or a text inside of it. Besides I check if the logged user have the affiliate role before showing the tab.

    $whitelist_roles = array(
        'affiliate'
    );
    
    $current_user_role = prefix_get_current_user_roles()[0];
    
    if ( in_array( $current_user_role, $whitelist_roles ) ) {
        // Add rewrite url.
       add_action( 'init', function() {
           add_rewrite_endpoint( 'custom', EP_ROOT | EP_PAGES );
       });
    
       // Add custom menu item to the sidebar.
       add_filter( 'woocommerce_account_menu_items', function( $items ) { 
           $items['custom'] = esc_html__( 'Affiliate', 'text-domain' );
    
           return $items;
       } );
    
       // Display the content for the custom endpoint.
       add_action( 'woocommerce_account_custom_endpoint', function() {
     
            echo do_shortcode( ' [affiliates_dashboard] ' );//For shortcode
    
       });
    }
    
    function prefix_get_current_user_roles() {
        if ( ! is_user_logged_in() ) {
            return array();
        }
    
        $user  = wp_get_current_user();
        $roles = (array) $user->roles;
    
        return $roles;
    }
    Plugin Author Kento

    (@proaktion)

    Thanks for sharing that @montino – I was just wondering about adding the tab and that’s what you did, that’s a great solution!

    Thread Starter svtmontagna

    (@montino)

    I also reordered the tabs to not have the “Affiliation” tab under logout. But this is only an aesthetic thing.

    add_filter( 'woocommerce_account_menu_items', 'bbloomer_add_link_my_account' );
     
    function bbloomer_add_link_my_account( $items ) {
       $newitems = array(
          'dashboard'       => __( 'Dashboard', 'woocommerce' ),
    	  'orders'          => __( 'Orders', 'woocommerce' ),
    	  'downloads'       => __( 'Downloads', 'woocommerce' ),   
    	  'edit-address'    => _n( 'Addresses', 'Address', (int) wc_shipping_enabled(), 'woocommerce' ),
          'edit-account'    => __( 'Account details', 'woocommerce' ),
    	  'affiliate'    => __( 'Affiliate', 'woocommerce' ),
    	  'customer-logout' => __( 'Logout', 'woocommerce' ),
       );   
       return $newitems;
    }
    Thread Starter svtmontagna

    (@montino)

    I just noticed that the “affiliate” role doesn’t seem to work if I add it to the snippet whitelist above. I tried roles like “administrator” or “shop-manager” am I wrong? What is the name of the affiliate role?

    Plugin Author Kento

    (@proaktion)

    The affiliates aren’t assigned a particular role with the base plugin, but if you use this https://github.com/itthinx/affiliates-role they will be added to the Affiliate role you’re using.

    Thanks for sharing the bit about reordering the tabs, that’s certainly useful, too!

    Thread Starter svtmontagna

    (@montino)

    This works even if I add manual affiliate or only through registration?

    Plugin Author Kento

    (@proaktion)

    For both ways, if it’s activated while you add them. But it won’t do the role assignment for existing ones.

    Thread Starter svtmontagna

    (@montino)

    It works, but you need to edit the array on the first snippet:
    $current_user_role = prefix_get_current_user_roles()[0];
    Need to be:
    $current_user_role = prefix_get_current_user_roles()[1];

    On my case at least, because I don’t let user to signup as affiliate but I manually add an affiliate already registered which is a subscriber by default and the array returns [subscriber, affiliate].

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Number of users who purchase through an affiliate’ is closed to new replies.