Created
June 15, 2020 22:10
-
-
Save Pebblo/2fd4a207fd7c20cff73fdef49b09389c to your computer and use it in GitHub Desktop.
Example of how to change the product type used in Infusionsoft for Promotions line items.
This file contains 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 //Please do not include the opening PHP tag if you alreayd have one. | |
add_filter('FHEE__EEE_Infusionsoft_Line_Item__ext_sync_to_infusionsoft__product_type', 'tw_ee_is_promotion_line_item_type', 10, 2); | |
function tw_ee_is_promotion_line_item_type($is_product_type, $line_item); | |
//If processing a line item and te Promotions add-on is active. | |
if ($line_item instanceof EE_Line_Item && class_exists('EE_Promotion')) { | |
// Check if the object related to the line item as an EE_Promotion. | |
$obj = $line_item->get_object(); | |
if ($obj instanceof EE_Promotion) { | |
// Set line item type to be 'Special: Product' which is type 12. | |
$is_product_type = 12; | |
} | |
} | |
return $is_product_type; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment