Reputation: 1766
my custom product type is : tour
$args = array(
'post_type' => 'product',
'posts_per_page' => 25,
'tax_query' => array(
array(
'taxonomy' => 'product_type',
'field' => 'slug',
'terms' => 'tour',
),
),
);
$products = new WP_Query($args);
how get custom product type data ( date and day and active/deactive and ... ) on woocommerce loop in top query?
Thanks
Upvotes: 0
Views: 932
Reputation: 1766
you should Creating a Custom Product Type and adding Custom Fields to Product Settings .
Then to get those values you just need to use the popular get_post_meta()
function. That’s pretty much all you need.
Example:
<?php
// Display Custom Field Value
echo get_post_meta( $post->ID, 'my-field-slug', true );
// You can also use
echo get_post_meta( get_the_ID(), 'my-field-slug', true );
?>
Upvotes: 2