Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Created January 7, 2025 18:45
Show Gist options
  • Save remcotolsma/20d400b32b7dc9ddb457c89525a6c1b5 to your computer and use it in GitHub Desktop.
Save remcotolsma/20d400b32b7dc9ddb457c89525a6c1b5 to your computer and use it in GitHub Desktop.
Make sure the next payment delivery date is set to the next payment date, this will overwrite a filter in the Mollie integration.
<?php
/**
* Make sure the next payment delivery date is set to the next payment date,
* this will overwrite a filter in the Mollie integration.
*
* @link https://github.com/pronamic/wp-pronamic-pay-mollie/blob/main/documentation/Wanneer-worden-incassobetalingen-verwerkt-en-uitbetaald.md
* @link https://github.com/pronamic/wp-pronamic-pay-mollie/blob/53949bd607d24782a18730a113993d230aa6feac/src/Integration.php#L326-L407
*/
add_filter(
'pronamic_pay_subscription_next_payment_delivery_date',
function ( $next_payment_delivery_date, $subscription ) {
$next_payment_date = $subscription->get_next_payment_date();
if ( $next_payment_date instanceof DateTimeInterface ) {
$next_payment_delivery_date = $next_payment_date;
}
return $next_payment_delivery_date;
},
20,
2
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment