Subscriptions – Get Price Per Month (Time period) from Wp_QUERY
-
Hi just wondering if anyone could direct me…
I’m doing the following:foreach ( $product_categories as $product_category ) { echo '<h4><a href="' . get_term_link( $product_category ) . '">' . $product_category->name . '</a></h4>'; $args = array( 'posts_per_page' => -1, 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $product_category->slug ) ), 'post_type' => 'product', 'orderby' => 'title,' ); $products = new WP_Query( $args ); echo "<ul>"; while ( $products->have_posts() ) { $products->the_post(); $product_id = get_the_ID(); $product = new WC_Product($product_id); // Ensure visibility if ( empty( $product ) || ! $product->is_visible() ) { return; } if(class_exists('WC_Subscriptions_Product') && WC_Subscriptions_Product::is_subscription(get_the_ID())) { echo WC_Subscriptions_Product::get_price_string(get_the_ID()); }
this will return 0 / month
I was wondering if anyone knew what I might be setting up wrong.
- The topic ‘Subscriptions – Get Price Per Month (Time period) from Wp_QUERY’ is closed to new replies.