Show products by vendor
-
I need urgent assistance regarding displaying products by vendor id. To explain it a bit further. I need a function to be placed under a shortcode that would display all the published products posted by logged in vendors with my wp site using WCMP.
I came across this class file but I would really appreciate it if you provide some assistance in making a custom function with shortcode please.
/** * Get all products belonging to vendor * @param $args (default=array()) * @return arr Array of product post objects */ public function get_products($args = array()) { global $WCMp; $default = array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => -1, 'author' => $this->id, 'tax_query' => array( array( 'taxonomy' => $WCMp->taxonomy->taxonomy_name, 'field' => 'term_id', 'terms' => absint($this->term_id) ) ) ); $args = wp_parse_args($args, $default); return get_posts( apply_filters( 'wcmp_get_vendor_products_query_args', $args, $this->term_id ) ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Show products by vendor’ is closed to new replies.