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 | |
foreach( $users as $user_id ) | |
{ | |
// fetch the existing key | |
// please note that the key should NOT include the referral prefix | |
// so if your prefix is 'REF' then the final coupon here will be 'REF1234' | |
$key = '1234' | |
$object = new AW_Model_Referral_Advocate_Key(); |
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 | |
/** | |
* An example of how to filtering the value of a variable | |
* | |
* In this example we will format user first and last names. | |
*/ | |
add_filter( 'automatewoo/variables/after_get_value', 'my_automatewoo_variable_filter_names', 10, 5 ); | |
/** |
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 | |
/** | |
* Add the custom variable to the list | |
*/ | |
add_filter( 'automatewoo/variables', 'my_automatewoo_variables' ); | |
/** | |
* @param $variables array | |
* @return array | |
*/ |
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 | |
add_filter('automatewoo/rules/includes', 'my_automatewoo_rules' ); | |
/** | |
* @param array $rules | |
* @return array | |
*/ | |
function my_automatewoo_rules( $rules ) { | |
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 | |
add_filter('automatewoo/referrals/coupon_data', 'my_automatewoo_referrals_coupon_data' ); | |
/** | |
* Restrict referral coupon to product IDs | |
* | |
* @param array $coupon_data | |
* @return array | |
*/ |
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 | |
add_filter( 'automatewoo/referrals/validate_coupon_for_user', 'my_automatewoo_referral_coupon_validate', 10, 3 ); | |
add_filter( 'automatewoo/referrals/validate_coupon_for_guest', 'my_automatewoo_referral_coupon_validate', 10, 3 ); | |
/** | |
* $valid is true if coupon is valid for user or an instance of WP_Error if the coupon is invalid | |
* | |
* @param WP_Error|true $valid |
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 | |
add_filter('automatewoo/referrals/invite_email/mailer', 'my_filter_referrals_invite_email', 10, 2 ); | |
/** | |
* @param AW_Mailer $mailer | |
* @param AW_Referrals_Referral_Invite_Email $invite | |
* @return AW_Mailer | |
*/ | |
function my_filter_referrals_invite_email( $mailer, $invite ) { |
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 | |
add_filter( 'automatewoo/referrals/reward_amount', 'my_automatewoo_referral_reward_amount', 10, 3 ); | |
/** | |
* @param $reward_amount | |
* @param AW_Model_Referral_Advocate $advocate | |
* @param WC_Order $order | |
* @return mixed | |
*/ |
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 | |
add_filter( 'automatewoo/preview_data_layer', 'my_filter_automatewoo_preview_data_layer' ); | |
/** | |
* @param array $data | |
* @return array | |
*/ | |
function my_filter_automatewoo_preview_data_layer( $data ) { |
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 | |
add_action( 'admin_menu', 'my_maybe_remove_automatewoo_from_admin_menu', 5 ); | |
function my_maybe_remove_automatewoo_from_admin_menu() { | |
if ( ! current_user_can( 'administrator' ) ) { | |
remove_action( 'admin_menu', [ 'AutomateWoo\Admin', 'admin_menu' ] ); | |
} | |
} |