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>";
}
Related Posts:
- how to override woocommerce specific loop or archive-product.php [closed]
- Get all products with a custom attribute
- pagination in woocommerce order history page
- Show attribute description when filtering by that attribute
- Create a Custom menu item fetched by Product Categories and Sub Categories
- Disable email field on WooCommerce customer account details
- Show post page only if the user has bought a specific product
- redirect product-category to a custom page
- Woocommerce Product page edit
- Setting up Different Layouts for Each Product Category and Subcategory [closed]
- How to redirect WooCommerce shop URL?
- Unable to display custom fields on WooCommerce product pages
- Send a custom WooCommerce email when custom order change [closed]
- Change WooCommerce product price based on category and GEO IP country
- Automatically Update Woocommerce Prices [closed]
- Add custom field to woocommerce variations [closed]
- how to get the categories for a single product in a hierarchical way
- Viewing checkout page removes fees from mini cart
- woocommerce_checkout_fields modifying existing billing_phone label created new field
- How to add an extra button on woocommerce shop page and use it to send the product info with image in a mail? [closed]
- how do I remove the shipping from woocommerce thankyou page and from the email
- Woocomerce custom billing address fields display in order details [closed]
- help to change some colors (woocomerce and store locator) [closed]
- No shipping method has been selected [closed]
- Changer numbers of columns in woocommerce shop
- Woocommerce product permalink not working
- “woocommerce_form_field()” function having issues after latest woocommerce update [closed]
- How to customize shipping region/states on WooCommerce
- Rename WooCommerce sorting dropdown options [closed]
- WooCommerce custom billing fields on email address
- Woocommerce custom checkout form
- Woocommerce custom field calculation
- Hiding Short Description in Shop Page, WooCommerce
- wordpress shortcode not working
- I found this code to be very useful, how can I change it to a text that display “Product versions and period of last update” rather than a button?
- Customizing woocommerce product page
- Woocommerce custom archive page custom content and shortcode
- WP_Query – sort the results by meta value custom attribute wocoomerce
- customer specific email attachment
- Style WooCommerce Product Search Widget
- Product page not found if product data is set Appointment Service
- Query Product categories what have a custom field
- How to get the full product name by ignoring custom modification on it
- where is admin footer?
- Woocommerce custom “My Account” Tab – Add Save button
- Need to add custom text field to Woocommerce under add to cart button
- Moving Quantity after product description
- Custom product status get filtered on all product list views
- Can we add an extra button on woocommerce shop page and use it to send the product info including image in a mail?
- Upload advanced custom field text link array with csv
- Woocommerce – Remove cart button depending product (post) status
- WordPress Performance and bulk edits
- I want to use a product thumbnail completely different than the product image
- Including a Customized Initialize File with a wordpress header
- Send default WooCommerce email when switching from custom order status
- How to Remove wpautop in woocommerce includes folder class-wc-order-item.php
- WooCommerce – Adding custom HTML to specific product pages
- How do I change text of a product template in a WooCommerce theme? [closed]
- WooCommerce customise checkout billing form [closed]
- Integrate Woocommerce to a custom theme
- woocommerce display product category on checkout page [closed]
- Save And Display Mp3 Audio files on WooCommerce product page with Dokan
- Change the User/ Author of the Products
- Show total sales for each products on search results page Woocommerce
- Change in credit card payment button for woocommerce
- How to display product variations on same row
- Custom product sorting archive page
- Where are Additional CSS files stored
- What Is The Use Of map_meta_cap Filter?
- Need logged in users returing to site redirected to a separate page
- Widgets vs. Theme Mods
- Adding an email column to a Custom Post Types Admin Screen?
- Allow Users to Set Password During Registration
- Custom search page and search by title, content and tag
- Adding code to child’s theme css and php cannot override certain elements
- Static admin page for all multisite users
- Using custom image resizing script in a page
- How to use default WP form elements to interact with custom DB table?
- How do I add a promotional message to my posts?
- WooCommerce: One term for Many Product Attributes
- NextGEN Gallery – open all images on page in fancybox [closed]
- How to stop displaying the Id without losing the functionality
- Simplify the admin end
- Divi: how to hide/show specific menu according current page?
- buddypress remove username from autocomplete
- When should I not use WordPress? [closed]
- Custom Post Types database persistance. Why not?
- Any Good WordPress Client Like Live Writer To Create Static Pages
- WordPress homepage hangs in IE browsers
- Don’t update modify time post on Quick Edit
- Avoid showing the same phrase in the loops
- Why does a custom php code inside a custom template not get executed?
- Custom permalink structure for posts in certain categories
- Hosing a website within a WordPress directory/folder
- Creating a dynamic URL for an external link inside content
- Custom Single Template
- how to auto fille conatct form 7 when user is logined
- How to use hook admin_init for add_action for custom post type column
- WordPress uploads directory. Featured Images storage
- Upgrade to 3.1.1 Fails