pikehook
pikehook
// Add Shortcode function pikehook() { $full_product_list = array(); $loop = new WP_Query(array('post_type' => array('product', 'product_variation'), 'posts_per_page' => -1)); while ($loop->have_posts()) : $loop->the_post(); $theid = get_the_ID(); $product = new WC_Product($theid); if (get_post_type() == 'product_variation') { // ****************** end error checking ***************** } else { $sku = get_post_meta($theid, '_sku', true); $selling_price = get_post_meta($theid, '_sale_price', true); $regular_price = get_post_meta($theid, '_regular_price', true); $description=get_the_content(); $thetitle = get_the_title(); } // add product to array but don't add the parent of product variations if (!empty($sku)) $full_product_list[] = array("PartyID" => (int) $party_id,"Description"=> $description, "ExternalNumber" => $theid, "ProductName" => $thetitle, "sku" => $sku, "RegularPrice" => $regular_price, "SellingPrice" => $selling_price, "ExternalProductCategoryId" => $cat_id, "ExternalProductCategoryName" => $cat_name); endwhile; } add_shortcode( '', 'pikehook' );