Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created November 22, 2024 08:09
Show Gist options
  • Save andrewlimaza/2c7df8fd3c1ec060970d5e161ecca1c5 to your computer and use it in GitHub Desktop.
Save andrewlimaza/2c7df8fd3c1ec060970d5e161ecca1c5 to your computer and use it in GitHub Desktop.
Adjust CCBill Sub Account for Paid Memberships Pro Checkouts
<?php
/**
* Change the CCBill Sub Account for AddOn Package purchase.
* This can be tweaked further to change the subaccount (or any other argument) based on custom conditionals.
*
* REQUIRES PMPRO CCBILL 0.6+
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_ccbill_change_sub_account( $ccbill_args, $order ) {
// Let's replace the subaccount when we get AddOn Package purchase.
if ( ! isset( $_REQUEST['ap'] ) ) {
return $ccbill_args;
}
$ccbill_args['clientSubacc'] = '123456'; // Replace 123456 with your subaccount number for single purchases.
return $ccbill_args;
}
add_filter( 'pmpro_ccbill_checkout_args', 'my_pmpro_ccbill_change_sub_account', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment