Created
August 23, 2022 11:27
-
-
Save Pebblo/724f8d94b1019b8209ad62a70eb728b8 to your computer and use it in GitHub Desktop.
Example of how to force promotions to only apply to a single event within the cart
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__EED_Promotions__get_applicable_items__applicable_items', 'tw_ee_promotions_only_single_applicable_item', 10, 5); | |
function tw_ee_promotions_only_single_applicable_item( | |
$applicable_items, | |
$promotion, | |
$redeemable_scope_promos, | |
$events, | |
$cart | |
) { | |
if(stripos($promotion->code(), 'CART') !== false) { | |
$first_applicable_item[] = reset($applicable_items); | |
return $first_applicable_item; | |
} | |
return $applicable_items; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment