function wdc_enqueue_scripts() { wp_enqueue_script( 'wdc-scripts', plugins_url( 'js/wdc-scripts.js', __FILE__ ), array( 'jquery' ), '1.0', true ); wp_enqueue_style( 'wdc-styles', plugins_url( 'css/wdc-styles.css', __FILE__ ), array(), '1.0' ); } add_action( 'wp_enqueue_scripts', 'wdc_enqueue_scripts' ); function enqueue_dropdown_scripts() { wp_enqueue_script( 'wdc-scripts', plugins_url( '/js/wdc-scripts.js', __FILE__ ), array( 'jquery' ), '1.0', true ); } add_action( 'wp_enqueue_scripts', 'enqueue_dropdown_scripts' ); function enqueue_dropdown_styles() { wp_enqueue_style( 'wdc-styles', plugins_url( '/css/wdc-styles.css', __FILE__ ), array(), '1.0' ); } add_action( 'wp_enqueue_scripts', 'enqueue_dropdown_styles' ); function display_products() { // Get the selected category and attribute values $selected_cat = isset($_POST['product_cat']) ? $_POST['product_cat'] : ''; $selected_size = isset($_POST['pa_size']) ? $_POST['pa_size'] : ''; $selected_color = isset($_POST['pa_color']) ? $_POST['pa_color'] : ''; $selected_type = isset($_POST['pa_type']) ? $_POST['pa_type'] : ''; // Arguments for the WP_Query class $args = array( 'post_type' => 'product', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $selected_cat, ), array( 'taxonomy' => 'pa_size', 'field' => 'slug', 'terms' => $selected_size, ), array( 'taxonomy' => 'pa_color', 'field' => 'slug', 'terms' => $selected_color, ), array( 'taxonomy' => 'pa_type', 'field' => 'slug', 'terms' => $selected_type, ), ), ); // The WP_Query object $query = new WP_Query($args); // If there are any products that match the selected categories and attributes if ($query->have_posts()) { // Loop through the products while ($query->have_posts()) { $query->the_post(); // Get the product data $product = wc_get_product(get_the_ID()); $title = $product->get_title(); $price = $product->get_price(); // Display the product data echo '

' . $title . '

'; echo '

' . $price . '

'; } wp_reset_postdata(); } else { // If no products were found echo '

No products found

'; } } function wdc_enqueue_scripts() { wp_enqueue_style('wdc-styles', plugin_dir_url(__FILE__) . 'wdc-styles.css'); wp_enqueue_script('wdc-scripts', plugin_dir_url(__FILE__) . 'wdc-scripts.js', array('jquery'), '1.0.0', true); } add_action('wp_enqueue_scripts', 'wdc_enqueue_scripts'); Cageys Printed T-Shirts – Cageys T-Shirts