Forgive me if someone has asked this before, but i am trying to get some attributes displayed next to displayed content of product. I see the hook woocommerce_before_single_product_summary
that displayed few attributes but not all. The woocommerce_before_single_product_summary
let me back to directory structure in woo/templates/single-products/filename which is just
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $post, $product;
if ($product->is_on_sale()) :
apply_filters('woocommerce_sale_flash', '<span class="onsale">'.__( 'Sale!', 'woocommerce' ).'</span>', $post, $product); ?>
endif;
Now i am lost, where do i go from here? How do i add my attributes to my product-catalog and single product page? Where do i go from the apply_filters
? How do i find the generated html for the attributes?
A look at the documentation or the source is always helpful. I guess, the correct file to refer to would have been
product-attributes.php
. For getting the product attributes this is available:get_attribute()
; to list themlist_attributes()
can be used, which makes use of theproduct-attributes.php
template. You can use those and then hook into the fitting one to display the attributes. To learn more about hooks give the Plugin API a good thorough read.