According to the documentation, wc_memberships_get_user_memberships()
returns a list of WC_Memberships_User_Membership
objects.
The WC_Memberships_User_Membership
class has a get_end_date()
method that will return the expiry date.
So you should be able to do something like this:
// Get memberships for the current user.
$memberships = wc_memberships_get_user_memberships();
// Verify that they have some memberships.
if ( $memberships ) {
foreach( $memberships as $membership ) {
// Print the expiration date in mysql format.
echo $membership->get_end_date();
}
}
The mysql date format is the default, but you can also use something like $membership->get_end_date( 'Y-m-d H:i:s' )
to have custom formatting or $membership->get_end_date( 'timestamp' )
to get the timestamp.
Related Posts:
- Order by rating not works in wp_query
- Woocommerce 3.1 Add product image to order confirmation email not working
- Woocommerce: show default variation price is products list?
- How to filter Post using Meta Data REST API
- WooCommerce checkout: How can I change $field_container of a checkout field?
- Move WooCommerce product tabs out of the tabs [closed]
- Is it possible to recalculate cart prices? [closed]
- Woocommerce: Get Cart ID
- Woocommerce – remove sale price field from dashboard [closed]
- how to use different page design for different category
- WooCommerce Country Drop Down colours CSS [closed]
- Fatal error: Call to undefined method WooCommerce::nonce_field()
- Where do I find where woocommerce stores product data in cpanel file manager?
- Woocommerce wp-admin search products through custom meta value too
- show shop instead of 404 page for missing products
- if statement for search results
- Woocommerce exclude specific categories products from related products
- Woocommerce: Prevent sending of email when order is “Completed”
- Apply a discount percentage to regular price WooCommerce by function
- Add sub subpage endpoint in woocommerce
- Edit WooCommerce product content based on category
- Server-Based CRON Job
- How to incluide custom field in WooCommerce email using placeholder
- Woocommerce: Can’t put items in cart in iframe and on iphone
- Display products by category in Woocommerce cart page?
- shortcode to display woocommerce cart total
- Checkout is blocked with blockUI when using action woocommerce_cart_calculate_fees
- Checkout form looks terrible [closed]
- How to upload multiple image using wp_insert_post
- How can i manage total price in checkout page? [closed]
- In WooCommerce product archive, how can you also set the quantity to be added to cart by typing, instead of just by using +/-?
- WooCommerce product category permalinks
- How to do string attachment with wp_mail
- Can’t show most recent comment on top with wp_list_comments() for WooCommerce reviews
- WooCommerce order complete email logic
- WooCommerce Displaying Price With & Without TAX [closed]
- Tried to create a user role that can only edit user information, but my test account cannot view the dashboard. What am I missing?
- Filtering variable WooCommerce products by stock level using meta_query
- How can I run a multi language WordPress site in two folders in one install? [closed]
- Dropdown menu not displaying WordPress
- WooCommerce – Create multiple product tags via rest api endpoint
- WooCommerce which roles and capabilities control user login re-direct to Woo Account Page?
- how do i remove a woo-commerce widget?
- How can I convert woocommerce checkout fields in capital letters
- main menu hide woo commerce single products tittle
- Conditional action hook
- Sending Email upon registration
- Order by date on category dynamically – Woocommerce
- Woocomnerce Limit Purchase value before proceed checkout
- Add to cart – button should be disabled
- How To Customize The Product Page Template for a WooCommerce Custom Product Type Plugin [closed]
- Hide Add to Cart button on woocommerce Product description page of a particular product
- Options to develop a non-ecommerce catalog?
- wp_set_object_terms setting only first id from array
- I need to export all products and images but I don’t know which table the images are in
- Add only sku to product url woocoomerce
- What is better way to sync wp multisite woocommerce products
- Remove required from a custom field created from WooCommerce Checkout Field Editor plugin
- How to change status of woocommerce orders when post status is changed
- manage_shop_order_posts_custom_column() hook is Not working In Functions.php file in my WordPress active theme
- How to send woocommerce emails in multiple languages
- Custom WooCommerce rewrite rules with comma delimiter
- Set city as required if country is Singapore
- Displaying Woocommerce Product Attributes on single product page
- WooCommerce – Child Category wont show, but Parent does
- WooCommerce Simple Auctions add username to auction finished email
- Enable Gutenberg for Woocommerce
- How to hide a random text with a div tag using a class on product pages with a specific tag
- Missing variable options on add to cart form
- Woocommerce digital download not working – database error Cannot add or update a child row: a foreign key constraint fails [closed]
- when product out of stock single page show button notify woo-commerce
- WooCommerce , Auto cancel orders status from processing after X days
- Change WooCommerce Word “Product” to Another Word
- How does a WooCommerce site integrate with the existing real world customer members?
- Recently viewed products – Order by viewed
- How can i add product Accessories from front-end using custom php form?
- How to save order item custom attributes save into custom table
- Manually create an order with a product ID woocommerce
- How to filter result set in custom metaboxes?
- How to change lost password email text using custom plugin wordpress?
- WooCommerce subscriptions give option of manual renewal on checkout [closed]
- How to hide / remove duplicated Woocommerce products from Shop page
- Change order status after checkout
- Is it safe to update an old site after backing it up and activating a child theme?
- How to add coupon expiry date into the followup emails?
- Disable Woocommerce main shop page, but not the product category archive pages
- Custom Woocommerce checkout filed yields a Json error when validating [closed]
- access Woo commerce | WordPress methods externally
- How to store ACF from product in user_meta?
- Woocommerce set single city to sell to
- Trying to link to a custom css file in a new folder
- eCommerce solution doesn’t want to display its shortcodes or any content where it’s set to [closed]
- How do I make a diagonal strikethrough on wordpress? [closed]
- Woocommerce – Remove ‘Buy Product’ Button from shop page [closed]
- Add woocommerce.css in template?
- How to change redirect code? [duplicate]
- How to dublicate WC Product title to shortdescription field? [closed]
- Add Additional 3 buttons next to “Add to cart” button in woocommerce product page
- Woocommerce product and category in url [closed]
- Display product categories + child-categories on a single product page