Skip to content

Instantly share code, notes, and snippets.

@tivnet
Last active October 5, 2018 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tivnet/8b0159667ca411859b47eaef466dc069 to your computer and use it in GitHub Desktop.
Save tivnet/8b0159667ca411859b47eaef466dc069 to your computer and use it in GitHub Desktop.
WooCommerce API Manager: Fix 1
<?php
// class WC_Api_Manager_Helpers
// Status can be lowercase.
public function is_user_subscription_active( $status ) {
// Wrong:
// return $status == 'Active' || $status == 'Pending Cancellation' ? true : false;
// Correct:
return ( strtolower( $status ) === 'active' || $status === 'Pending Cancellation' );
}
@tivnet
Copy link
Author

tivnet commented Jun 7, 2016

@toddlahman
For your attention
Thanks

@swoboda
Copy link

swoboda commented Oct 5, 2018

We translated WooCommerce Subscriptions to Polish and then API keys and downloads disappeared from My Account page.

Status slugs should be used (i.e. active, pending-cancel) and not names. Because status names can be translated and then the whole system breaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment