Display Affiliate Info on Packing Slip

Hi – I’m trying to set up the packing slip with information from the sale. I’ve been able to add custom fields from the billing info, but I need to add some indication of who the Referring Affiliate was, like their user name (user_login), or at least the referrer ID. Here is the php from the packing slip that I’m trying to edit. In the first what is should be in the custom_field parenthesis to show Affiliate info? I’ve tried a variety of values including ‘affiliate_id’, ‘referral_id’, ‘user_id’…with no luck. The field is showing on the packing slip, there’s just no value appearing beside “Organization”.

type, $this->order ); ?>

custom_field(‘affiliate_id’); ?>

custom_field(‘_billing_seller’); ?>

custom_field(‘_billing_seller_details’); ?>

order_number(); ?>

order_date(); ?>

shipping_method(); ?>

type, $this->order ); ?>

Thanks, guys!


Comments

3 responses to “Display Affiliate Info on Packing Slip”

  1. Erica Thumma Avatar
    Erica Thumma

    Thanks for this, Eugen! Will try it soon.

    1. Eugen Bleck Avatar
      Eugen Bleck

      Hi Erica,

      I trust you are well and awesome today!

      Thanks for your feedback.

      I wish you a great day ahead and an awesome start to your week!

      Warm regards,
      Eugen.

  2. Eugen Bleck Avatar
    Eugen Bleck

    Hi Erica,

    I trust you are well and safe!

    First off, I wish to apologize for the delayed response to your topic. Please forgive me!

    Thank you for being a valued customer of our plugins, it brings us great joy to have you as our valued customer.

    Though the order itself has no specific metadata stored that would point to the referral, you can relate an order from the referral.

    Here’s a simple walkthrough of how to add the affiliate ID to the invoice email template:

    add_action( ‘woocommerce_email_customer_details’,’cc_woocommerce_email_customer_details’, 10, 3 );

    function cc_woocommerce_email_customer_details( $object ){
    global $wpdb;

    // Getting the order id
    $order_id = $object->data[‘id’];

    // Query to fetch data from database table and storing in $results
    $results = $wpdb->get_results( “SELECT * FROM wp_aff_referrals WHERE post_id=$order_id”);

    // Checking to make sure results is not empty
    if( !empty($results) ){
    echo ‘Affiliate ID is: ‘.$results[0]->affiliate_id;
    }
    }

    The required info is queried from the database as seen above.
    Important resource URL:
    * http://docs.itthinx.com/document/affiliates-pro/api/referrals/

    Once again, I must thank you for your patience.

    In the meantime, I wish you an awesome and productive weekend.

    STAY SAFE!
    Kindest regards,
    Eugen.

Share