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!

3 Responses to Display Affiliate Info on Packing Slip

  1. Erica Thumma September 25, 2020 at 5:02 pm #

    Thanks for this, Eugen! Will try it soon.

    • Eugen Bleck September 28, 2020 at 12:01 pm #

      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 September 19, 2020 at 5:32 am #

    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.

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share