Last active
April 13, 2016 19:39
-
-
Save thomasplevy/82c423725410d1cae83b737234d63e1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // we clear the order session data and don't provide you a great way to regrab it for the next function | |
| // so do this shameful thing... | |
| add_filter( 'lifterlms_order_process_success', function( $order ) { | |
| LLMS()->session->set( 'my_temp_order', $order ); | |
| }, 10, 1 ); | |
| add_filter( 'lifterlms_order_process_success_redirect', function( $redirect ) { | |
| $order = LLMS()->session->get( 'my_temp_order' ); | |
| $redirect = add_query_arg( array( | |
| 'my_confirmation_variable' => 1, // we'll check for this later, change this variable to be whatever you want | |
| 'product_id' => $order->product_id, | |
| // add whatever other arguments to the url that you're going to need | |
| // or add none b/c we can grab them from our shameful session object instead | |
| ), $redirect ); | |
| }, 10, 1 ); | |
| add_action( 'wp_footer', function() { | |
| // only run this code when the variable is set | |
| if ( isset( $_GET['my_confirmation_variable'] ) { | |
| $order = LLMS()->session->get( 'my_temp_order' ); | |
| echo '<img src="mytrackingpixel.com?affiliateid=123&total=$order->total">'; //etc... | |
| // clear our shameful session | |
| unset( LLMS()->session->my_temp_order ); | |
| } | |
| } ); | |
| // order looks like this | |
| object(stdClass)[734] | |
| public 'user_id' => int 292 | |
| public 'billing_address_1' => string 'Aut officia laboris ut est numquam eiusmod exercitationem mollitia illum qui' (length=76) | |
| public 'billing_address_2' => string 'Dolore fuga Excepteur quidem quae eaque omnis cillum ipsam pariatur Nulla dolore voluptas numquam' (length=97) | |
| public 'billing_city' => string 'Eaque id dolor autem distinctio Sint rerum mollitia ducimus enim dolores quis' (length=77) | |
| public 'billing_state' => string 'Soluta pariatur Magnam nulla et voluptates qui velit asperiores' (length=63) | |
| public 'billing_zip' => string '98619' (length=5) | |
| public 'billing_country' => string 'US' (length=2) | |
| public 'product_id' => string '306' (length=3) | |
| public 'product_title' => string 'asdfasdfasdfasdf' (length=16) | |
| public 'payment_type' => string 'creditcard' (length=10) | |
| public 'payment_method' => string 'stripe' (length=6) | |
| public 'use_existing_card' => string '' (length=0) | |
| public 'cc_type' => string 'Visa' (length=4) | |
| public 'cc_number' => string '4242424242424242' (length=16) | |
| public 'cc_exp_month' => string '12' (length=2) | |
| public 'cc_exp_year' => string '2017' (length=4) | |
| public 'cc_cvv' => string '123' (length=3) | |
| public 'order_completed' => string 'no' (length=2) | |
| public 'payment_option' => string 'single' (length=6) | |
| public 'payment_option_id' => string '0' (length=1) | |
| public 'product_sku' => string '' (length=0) | |
| public 'total' => string '102.50' (length=6) | |
| public 'product_price' => string '102.50' (length=6) | |
| public 'currency' => string 'USD' (length=3) | |
| public 'return_url' => string 'http://local.wordpress.dev/purchase/confirm-payment/' (length=52) | |
| public 'cancel_url' => string 'http://local.wordpress.dev/purchase/' (length=36) | |
| public 'stripe_token' => string 'tok_17zsw5KKLwCwSkCiKirzFDPX' (length=28) | |
| public 'stripe_customer_id' => string 'cus_8GPkUd5zC0kDyh' (length=18) | |
| public 'adjusted_total' => string '102.50' (length=6) | |
| public 'error_url' => string 'http://local.wordpress.dev/purchase/' (length=36) | |
| public 'product_type' => string 'course' (length=6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome. Kicking the tires with this now.
Missing a closing
)on line 29. 😄Thanks so much, Thomas!