This topic has 9 replies, 2 voices, and was last updated 3 years, 3 months ago ago by Rose Tyler
Hello I managed to use the below code to add attribute names to the product content elements. But I wonder is there any code to display the attribute images (in circle shape) as well?
add_action('woocommerce_after_shop_loop_item_title', 'show_attributes', 10);
function show_attributes(){
global $product;
if ($product->get_attribute('pa_color')){
echo '<p>' . wc_attribute_label('pa_color') . ': ' . $product->get_attribute('pa_color') . '</p>';
}
if ($product->get_attribute('pa_size')){
echo '<p>' . wc_attribute_label('pa_size') . ': ' . $product->get_attribute('pa_size') . '</p>';
}
}
Hello,
Please watch this video – https://youtu.be/LgzC4iK-j6A
If this is not what you are looking for, describe the request in more detail.
Regards
Thank you for your reply.
But I don’t wan’t to make it as a variable product. I just want to show the attributes as icons on the shop page.
Hello,
Sorry, but additional customization in files is out of our basic support scope. The theme support team can help you only with existing options – https://www.8theme.com/documentation/xstore/support/support/
Regards
Do you know any online materials that can help me to customise myself
I assume I can simply modify the code (that i posted on the first floor) a bit to make it to display the attribute icons instead of the attribute name text.
Download file from this page – https://dropmefiles.com/baMKn , with instruction.
If this is not what you are looking for, submit customization request to WPKraken team
Regards
Thank you. it works well and this is exactly what I want.
But there is one problem, when there are many icons, the placement of the icons will overlap with the icons of other products beyond the scope of the product. I think the icon should not be out of range, but continue to be placed in the next row.
Here is custom CSS code:
.etheme-custom-product-attributes ul {
display: inline-block;
}
Regards
You must be logged in to reply to this topic.Log in/Sign up