How to get price and order id for membership 2

I am trying to implement JROX Affiliate Manager with my site membership. I am using Membership 2 and JROX has pixel tracking option. I need to add this to my thank you page of membership 2;
<img src="https://www.***********.com/affiliates/sale/amount/$AMOUNT/trans_id/$ORDER_ID" width="1" height="1" border="0" />

But I don't know how to change $AMOUNT with the actual price of the membership and $ORDER_ID with the actual order ID or transaction ID. Can you help me with that?

  • Panos
    • SLS

    Hi PDQ Digital Media ,

    You can use the subscription id that is available in the $_GET or $_REQUEST vars in that page.

    You can use the_content filter to check this or wp_head, or the ms_controller_shortcode_ms_note which is specific for this shortcode. Here is an example snippet:

    add_action( 'ms_controller_shortcode_ms_note', function( $ms_note ){
        if ( isset( $_REQUEST['ms_relationship_id'] ) ){
            $subscription = MS_Factory::load( 'MS_Model_Relationship', (int) $_REQUEST['ms_relationship_id'] );
            // In case you need membership name:
            //$membership = $subscription->get_membership();
            //$membership_name = $membership->name;
            $invoice = $subscription->get_current_invoice();
            $invoice_id = $invoice->id;
            $invoice_total = $invoice->total;
            $ms_note .= '<script src="https://www.***********.com/affiliates/sale/amount/' . $invoice_total . '/trans_id/' . $invoice_id . '...." ></script>';
        return $ms_note;
    } );

    Hope this helps!

    Kind regards!

  • Panos
    • SLS

    Hi PDQ Digital Media ,

    Apologies for not being so clear. I had the impression you already had some code and needed a way to get the amount and invoice id.

    I have attached a file here. You can download and unzip it. Then open file to edit it, and change the line with the img tag to how your affiliate provider has instructed. In that line you can use the
    for the amount and
    for the trans_id.

    For trans_id you may prefer to use $subscription->id

    Once you edit that file upload it to your wp-content/mu-plugins folder. If the mu-plugins folder doesn't exist you can simply create it.

    Now after a payment is completed member will be directed to the Thank You page. In the bottom of that page it should print that img tag.

    Hope this helps!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.