Skip to content

Instantly share code, notes, and snippets.

@picocodes
Created February 6, 2023 07:33
Show Gist options
  • Save picocodes/a847613fa9242efc79ee8da1aa8ac561 to your computer and use it in GitHub Desktop.
Save picocodes/a847613fa9242efc79ee8da1aa8ac561 to your computer and use it in GitHub Desktop.
<?php
add_action(
'getpaid_submissions_process_items',
function( &$submission ) {
/**@var GetPaid_Payment_Form_Submission $submission */
$percent = 5 / 100; // 5% processing fee.
$submission->remove_fee( 'Processing Fee' );
$submission->add_fee(
array(
'name' => 'Processing Fee',
'initial_fee' => $submission->get_subtotal() * $percent,
'recurring_fee' => $submission->get_recurring_subtotal() * $percent,
)
);
return $submission;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment