Support » Plugin: WooCommerce » get_post_meta – woocomerce products

  • Hey guys! I have the below code in my themes functions.php which creates a new tab on the product page.

    The only issue is, is that the get_post_meta is not working. I have added it to the products custom fields and this code normally works on standard wordpress posts. But not with a woocommerce post/product.

    Any ideas? 🙁

    add_action( 'woocommerce_product_tabs', 'sb_woocommerce_new_tab', 40 );
    add_action( 'woocommerce_product_tab_panels', 'sb_woocommerce_new_panel', 40 );
    function sb_woocommerce_new_tab() {
     echo '<li><a href="#tab-new">' . __('Technical Documents', 'woocommerce') . '</a></li>';
    function sb_woocommerce_new_panel() {
     echo '<div class="panel" id="tab-new">
     <h2>Technical Docs</h2>'; ?>
    <?php echo get_post_meta($post->ID, 'rel_cat', true); ?>
     echo '</div>';

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘get_post_meta – woocomerce products’ is closed to new replies.