Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have added some custom fields to my products in woocommerce. I would like to use those same custom fields in a function that outputs product data based on custom field info.

I first need to access my product data from another page other than 'shop' as this is going to part of a customer interaction piece of the site. For example, if I wanted to output all products that have value "tweed" in custom field "fabric", how would I do that from a page that isn't the main product page.

Here is a piece of the code that I've tried. But woocommerce_page_title isn't outputting.

<?php $key_1 = get_post_meta($post->ID, 'fabric', true);

  if($key_1 == 'tweed') {
     echo 'check out the following products:';
     echo do_shortcode('[woocommerce_page_title]');
  } else {} 
?>
share|improve this question
    
I think what I need to do involves using the "woocommerce_template_single_meta" function. This guy here does something similar to what I want to do using tags: remicorson.com/list-woocommerce-products-by-tags but in my case, I need to use custom fields. Anyone have some pointers? –  bklynM Oct 13 '13 at 20:02
    
Found a solution here if anyone needs similar: remicorson.com/list-woocommerce-products-by-tags –  bklynM Oct 19 '13 at 22:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.