Color swatches on category page? [closed]

Try this code add_action( ‘woocommerce_after_shop_loop_item’, ‘sm_display_product_color_options’, 9 ); function sm_display_product_color_options(){ global $woocommerce, $product; $variation_colors_data = $product->get_attributes(); $variation_colors_data = $variation_colors_data[‘color’]; $variation_colors = $variation_colors_data[‘options’]; echo “<div class=”product_colors_container”>”; foreach ($variation_colors as $variation_color) { echo “<div class=”variable-item-span variable-item-span-color” style=”background-color:”.$variation_color.””>”.$variation_color.”</div>”; } echo “</div>”; } Review below screenshot

WooCommerce: How can I get orders with a custom ID in order meta data object?

You would add the meta_query portion to your wc_get_orders() as the only filter … function woocommerce_account_orders( $current_page ) { $current_page = empty( $current_page ) ? 1 : absint( $current_page ); $customer_orders = wc_get_orders( apply_filters( ‘woocommerce_my_account_my_orders_query’, array( ‘page’ => $current_page, ‘paginate’ => true, ‘meta_query’ => array( array( ‘key’ => ‘mycustom_id’, ‘value’ => get_current_user_id(), ‘compare’ => ‘=’ … Read more