• HOME
  • NEWS
  • PORTFOLIO
  • LAB
  • ABOUT
  • CONTACT

woocommerce membership and subscription plugin snippet

tags : phpsnippetwoocommercewordpress categories : programmation

by Trân on January 18, 2020


Notice: A non well formed numeric value encountered in /home/tigerbal/www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/tigerbal/www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Notice: A non well formed numeric value encountered in /home/tigerbal/www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/tigerbal/www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Notice: A non well formed numeric value encountered in /home/tigerbal/www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/tigerbal/www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Get membership object from user id

1
2
3
function get_membership($user_id) {
     return wc_memberships()->get_user_memberships_instance()->get_user_memberships( $user_id )[0] ??null;
}

Get member id from user id

1
2
3
4
5
function get_member_id($user_id) {
     if (get_membership($user_id))
          return get_membership($user_id)->get_id();
     else return null;
}

Get subscription id from member id

1
2
3
4
function get_subscription_id($member_id) {
     $subscription_id = get_post_meta( $member_id, '_subscription_id', true );
     return $subscription_id;
}

 

wordpress filter set-screen-option not working » « Thylacine

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

 
Tags / Mots clefs

php • snippet • woocommerce • wordpress
 

© fruit du dragon - freelance creative coder

Categories

  • général
  • inspiration
  • lab
  • programmation
  • sites
  • work

Tags

android architecture archives canvas cellules-studio cornelius css culturel demonstrateur design eshop flash fremok html html/css/js hugo IFTTT incandescence Instagram institutionnel ios ipad jeux js krpano luxe media design mobile musée nomoon paper fold photographie requins-marteaux responsive sbam snippet tablette toute-attente tran nn transport typographie ui ultranoir woocommerce wordpress

Stats


Notice: Undefined variable: extra in /home/tigerbal/www/wp-content/plugins/pulsemaps/pm-widget.php on line 47

Archives

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org