Home › Forums › WoodMart support forum › double field for “Show product brands next to title”, “Brand attribute”
double field for “Show product brands next to title”, “Brand attribute”
- This topic has 5 replies, 2 voices, and was last updated 3 years, 1 month ago by
Aizaz Imtiaz Awan.
-
AuthorPosts
-
June 13, 2022 at 10:05 pm #382871
loraloraParticipantHello
I ask you for help.
I have 2 attributes: Man Collection, Woman Collection.1. I need to display these two attributes under the product name on archive pages.
2. Display these two attributes on the single product page.those If the Product is in the “men’s collection” – display only these values
If the Product is in the “women’s collection” – display only these values.My friend has either the “Men’s Collection” attribute or the “Men’s Collection” attribute.
Right now I was only able to show for “Women’s Collection” – I used “Show product brands next to title” and “Brand attribute and Show brand on the single product page and Brand position on the product page – on the right”.
my question is: How to display the same values for the attribute “Men’s collection” for products that have this attribute?
Is there a custom code for this? for example, to make an additional double field for the second brand attribute and display the value for the “Men’s collection”? Can you share the code?
Thanks a lot
June 14, 2022 at 10:55 am #382950
Aizaz Imtiaz AwanKeymasterHello,
Sorry but there is no option in Theme Settings available for that.
It requires customizations and this is beyond our limitations and support policy.
Best Regards
June 14, 2022 at 6:51 pm #383040
loraloraParticipantvery sorry to hear that
In any case, I need a hook from you to output my attribute at this location. See screenshot
Attachments:
You must be logged in to view attached files.June 14, 2022 at 7:07 pm #383049
loraloraParticipantMaybe you have a code how to display a certain attribute?
for example, if a product has the “pa_size_plus” attribute, then display its values as links to all products with this attribute value (for example, how do you implement this with “brands”?
I would then add it to “
woocommerce_after_shop_loop_item_title
” and your hook, which you would indicate to me at the request above, because I’m already exhausted., especially since I see that you help some users with a short codeThanks
June 14, 2022 at 7:38 pm #383054
loraloraParticipantI found the code, and it seems to output what I need.
I have 2 questions for you:
1. share the hook from the question above (to add exactly where the brands.
2. please tell me how to display not just a value, but a link to the attribute value? look at my code…add_action('woocommerce_after_shop_loop_item_title', 'display_shop_loop_product_attributes', 5); function display_shop_loop_product_attributes() { global $product; // Define you product attribute taxonomies in the array $product_attribute_taxonomies = array( 'pa_size_plus' ); $attr_output = array(); // Initializing // Loop through your defined product attribute taxonomies foreach( $product_attribute_taxonomies as $taxonomy ){ if( taxonomy_exists($taxonomy) ){ $label_name = wc_attribute_label( $taxonomy, $product ); $term_names = $product->get_attribute( $taxonomy ); if( ! empty($term_names) ){ $attr_output[] = '<span class="'.$taxonomy.'"> '.$term_names.'</span>'; } } } // Output echo '<div class="wd-product-brands-links woodmart-product-brands-links">'.implode( '<br>', $attr_output ).'</div>'; }
June 15, 2022 at 10:49 am #383162
Aizaz Imtiaz AwanKeymasterHello,
Sorry but we could not help with third party code snippets. This is out of our theme support scope.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register