Last active
December 4, 2018 22:49
-
-
Save odessy/8155b0581d952901340b31c81499f02a to your computer and use it in GitHub Desktop.
wc_1cu_after_item_add snippet to identify the funnel
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
| <?php | |
| add_action('wc_1cu_after_item_add', 'custom_after_item_add'); | |
| function custom_after_item_add($order){ | |
| if( !empty( $_GET['1cu_n'] ) && !empty( $order ) ) | |
| { | |
| //get funnel for the $order | |
| $funnel = gb_ocu_get_funnel_for_order_items( $order ); | |
| if( !empty( $funnel ) && !empty( $funnel['id'] ) && !empty( $funnel['funnel_offers'] ) ) | |
| { | |
| //check the funnel name | |
| if( $funnel['funnel_name'] == "Funnel Name" ) | |
| { | |
| $funnel['funnel_offers'] = maybe_unserialize( $funnel['funnel_offers'] ); | |
| $offer_id = intval( $_GET['1cu_n'] ); | |
| //get product_id for the specific offer | |
| if( isset( $funnel['funnel_offers'][ $offer_id ]['product_id'] ) ) | |
| { | |
| $product_id = $funnel['funnel_offers'][ $offer_id ]['product_id']; | |
| //addition code here | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment