Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daddiofaddio/02c9e131b746e695878c620d53ed6b34 to your computer and use it in GitHub Desktop.
Save daddiofaddio/02c9e131b746e695878c620d53ed6b34 to your computer and use it in GitHub Desktop.
Display Woocommerce Memberships shortcode (functions.php)
/* WOO MEMBERSHIPS TABLE SHORTCODE - WITH HEADER */
function ploa_woo_memberships_shortcode() {
if (!function_exists('wc_memberships') || is_admin()) {
return;
}
ob_start();
?>
<div class="woocommerce">
<h2><?php esc_html_e('My Membership', 'textdomain'); ?></h2>
<?php
wc_get_template('myaccount/my-memberships.php', array(
'customer_memberships' => wc_memberships_get_user_memberships() ,
'user_id' => get_current_user_id() ,
));
?>
</div>
<?php
return ob_get_clean();
}
add_shortcode('woo-membership', 'ploa_woo_memberships_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment