Hi @christophmuth
Are you using the plugins subscription functionality or WooCommerce Subscriptions?
If using the plugin’s built in subscription functionality you can do the following:
Hook in to filter bfwc_subscription_user_actions
which should include two objects; the array of actions and the subscription object. The filter is called in the bfwc_subscription_user_actions
function located in braintree-bfwc-functions.php
.
function bfwc_subscription_user_actions( $subscription )
{
$actions = array ();
if ( $subscription->has_status( 'active' ) || $subscription->has_status( 'past-due' ) ) {
$actions [ 'cancel' ] = array (
'label' => __( 'Cancel', 'braintree-payments' ),
'url' => add_query_arg( 'cancel-subscription', $subscription->id, wp_nonce_url( wc_get_endpoint_url( 'view-subscription', $subscription->id, wc_get_page_permalink( 'myaccount' ) ), 'cancel-subscription' ) )
);
$actions [ 'change_payment_method' ] = array (
'label' => __( 'Change Payment Method', 'braintree-payments' ),
'url' => wc_get_endpoint_url( 'change-payment-method', $subscription->id, wc_get_page_permalink( 'myaccount' ) )
);
} elseif ( $subscription->has_status( 'pending' ) ) {
$actions [ 'pay_for_subscription' ] = array (
'label' => __( 'Pay', 'braintree-payments' ),
'url' => $subscription->get_checkout_payment_url()
);
}
return apply_filters( 'bfwc_subscription_user_actions', $actions, $subscription );
}
If you are using WCS they have documentation on how to add actions to the subscription. That process is similar to what I have described above.
Kind Regards,