Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove meta through AbstractDataStoreCPT::update_meta()? #283

Open
rvdsteege opened this issue Nov 22, 2021 · 0 comments
Open

Remove meta through AbstractDataStoreCPT::update_meta()? #283

rvdsteege opened this issue Nov 22, 2021 · 0 comments
Labels

Comments

@rvdsteege
Copy link
Member

In the subscriptions data store, the $subscription->get_next_payment_date() can result in a null value (e.g. when a phase has a fixed number of periods and the last period has been reached). Updating the meta value with $this->update_meta( $id, 'next_payment', $subscription->get_next_payment_date() ) leaves the meta value unaffected, because there's an empty value check in https://github.com/pronamic/wp-pay-core/blob/3303f7f200796405e74b27f65a0965bad6fe5a77/src/AbstractDataStoreCPT.php#L228-L230

I've now added an explicit check for the null value to delete the post meta:

Question: Should the AbstractDataStoreCPT::update_meta() method also be able to remove post meta if the new value is null?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant