con
(@conschneider)
Engineer
Hi there,
I reckon you need to pass a parameter for $product = wc_get_product(); >> $product = wc_get_product(some_id); – right now $product is probable null and that causes the on bool error.
Kind regards,
Thread Starter
catheg
(@catheg)
Thanks @conschneider .
But I need to get the current product. So I don’t have any id ???
Hi there,
> need to get the current product. So I don’t have any id
It depends on how you arrive at
need to display the custom attributes of my products
Thread Starter
catheg
(@catheg)
Hi @kosiew ,
Sorry for my dummy question, I’m just starting the customization of woocommerce using the hooks. The code below works fine, but I want to display this information below the title of the product in the single product page.
Is there a hook to do this.
Where can I find the complete list of hooks.
add_action( ‘woocommerce_before_add_to_cart_form’, ‘get_product_attributes’, 60);
function get_product_attributes()
{
global $product;
// get the product attributes to display
$product_couleur = $product->get_attribute( ‘couleur’ );
// display the product attributes
echo ‘<h5>’;
echo $product_couleur;
echo ‘</h5>’;
)
Thx.
Hi there,
> Sorry for my dummy question
Questions are always welcome 😄
> Where can I find the complete list of hooks.
You can read more about the list of hooks here:
http://docs.woocommerce.com/wc-apidocs/hook-docs.html
I hope this points you in the right direction.
It looks like you may have found a solution to this. I am going to mark this as Resolved at this time. If you have another issue please feel free to open a new post. 🙂
Thanks!