What file has been modified and it's directory? sale-functions.php inside /wp-content/plugins/gamipress-referrals/includes
Why modify? To allow exclusion of products on total cart amount where the commision is based.
1.) The following lines of code has been added:
// Get the sale total
$sale_total = gamipress_referrals_get_sale_total( $affiliate_id, $referral_id, $sale_id, $integration );
// get order details
$order = wc_get_order( $sale_id );
if( $order ) {
// iterate on products purchased
foreach( $order->get_items() as $item_id => $item ) {
// get product id
$product_id = $item->get_product_id();
// get custom field value
$disable_for_commissions = get_field( 'disable_for_commissions', $product_id );
// if product settings for `disable_for_commissions` is enabled
// then deduct product price to the `$sale_total`
if( $disable_for_commissions ) {
$product = wc_get_product( $product_id );
$sale_total = $sale_total - $product->get_price();
}
}
// deduct total tax
$sale_total = $sale_total - $order->get_total_tax();
}
After this lines of code:
// Bail if already awarded the commission
if( (bool) $awarded ) {
return;
}
And before this lines of code:
if( $sale_total <= 0 ) {
return;
}
Inside the function gamipress_referrals_award_sale_commission()
2.) The following lines of code is the updated code inside sprintf value inside function gamipress_insert_user_earning() of it's parent function gamipress_referrals_award_sale_commission():
__( '%s earned as commision for referring a purchase of %s', 'gamipress-referrals' ),