Archived topic
Custom fields and WooCommerce
11 replies · Started by Thierry on September 27, 2016
Hello,
I use ACF and this plugin : https://wordpress.org/plugins/loushou-acf-for-woocommerce/
Ok for the back-office but how i display in front, wath's the hook ?
Thx
Where are you trying to display your field?
In the content with GP hooks "Inside Content Container"
but i think that is not the god thing with Woocommerce
Should work fine inside WooCommerce - that hook exists.
What are you adding to it?
A pdf file for download.
How i can work with the hook WooCommerce ? i use GP hooks or i copy a template of WooCommerce and i modify single-product.php ?
You can use GP Hooks, this would only show on WooCommerce templates for example:
<?php if ( function_exists( 'is_woocommerce' ) ) :
if ( is_woocommerce() ) { ?>
Text here will only show on WooCommerce pages
<?php }
endif; ?>
Thank you Tom.
Have you the same help for the WooCommerce pages ?
All of those hooks apply to WooCommerce as well as any other page.
The code I provided above will make it so any code inside it will only apply to WC pages.
But i don't found how i can write on my page product
see the image :
[URL=http://www.hostingpics.net/viewer.php?id=84662328GP.jpg][IMG]http://img15.hostingpics.net/thumbs/mini_84662328GP.jpg[/IMG][/URL]
Ah, you'll have to ask WooCommerce if an action (hook) exists there.
If it does, you'll need to write the function, as only GP hooks are available in GP Hooks.
This should help when it comes to writing a function: https://generatepress.com/knowledgebase/hook-list/
I understand, thank you Tom
No problem :)