-
AuthorPosts
-
March 30, 2018 at 1:21 pm #935299
I have created addition product tabs, but they are not showing on the product page, please can someone help me
Please tell me there is quick CSS so I can show these fields
April 1, 2018 at 3:49 pm #935780Hey sambo258,
Thank you for using Enfold.
Are you using the ACF plugin? Where do you want to place the info? Please try to use wooocommerce hooks to render the custom fields. Example:
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_extra_info', 2 ); function woocommerce_output_extra_info() { echo get_field('some_value'); }
// https://www.advancedcustomfields.com/resources/get_field/
// http://hookr.io/actions/woocommerce_after_single_product_summary/Best regards,
IsmaelApril 2, 2018 at 12:08 pm #936017Hi Ismael.
Yes it’s the ACF plugin
Is this in the bottom of PHP Function per chance/
April 2, 2018 at 12:25 pm #936024add_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_extra_info’, 2 );
function woocommerce_output_extra_info() {
echo get_field(‘chakra’);
echo get_field(‘mohs’);
echo get_field(‘measurements’);
echo get_field(‘origin’);
echo get_field(‘grade’);
}Does that look right?
April 2, 2018 at 12:47 pm #936038Hi,
Yes, that looks right, you can also try this one so it has labels with it:
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_extra_info', 2 ); function woocommerce_output_extra_info() { echo '<p><strong>Chakra:</strong> ' . get_field('chakra') . '</p>'; echo '<p><strong>MoHs:</strong> ' . get_field('mohs') . '</p>'; echo '<p><strong>Measurements:</strong> ' . get_field('measurements') . '</p>'; echo '<p><strong>Origin:</strong> ' . get_field('origin') . '</p>'; echo '<p><strong>Grade:</strong> ' . get_field('grade') . '</p>'; }
Hope it helps :)
Best regards,
NikkoApril 2, 2018 at 1:18 pm #936060Excellent, don’t know if you know how to make it show in the “Additional information” box per chance?
April 2, 2018 at 11:38 pm #936233Hi,
// This code should be added to the functions.php file of the child theme // Add custom info to Additional Information product tab add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 ); function woo_rename_tabs( $tabs ) { global $product; $tabs['additional_information']['callback'] = 'custom_function_name'; // this is the function name which is included below return $tabs; } function custom_function_name(){ echo '<p><strong>Chakra:</strong> ' . get_field('chakra') . '</p>'; echo '<p><strong>MoHs:</strong> ' . get_field('mohs') . '</p>'; echo '<p><strong>Measurements:</strong> ' . get_field('measurements') . '</p>'; echo '<p><strong>Origin:</strong> ' . get_field('origin') . '</p>'; echo '<p><strong>Grade:</strong> ' . get_field('grade') . '</p>'; }
Use the code like that, it should be OK!
Let us know if you need something else.Best regards,
BasilisApril 3, 2018 at 11:59 am #936485That worked fine thanks :)
April 3, 2018 at 2:18 pm #936568Hi sambo258,
Glad we could help :)
If you need further assistance please let us know.
Best regards,
VictoriaAugust 7, 2019 at 12:00 pm #1125471Hi, this code is no longer working with the new update.
Please can someone help.August 7, 2019 at 1:59 pm #1125536Never mind I reinstalled the old 4.5 version and it works again
August 7, 2019 at 5:25 pm #1125591Hi sambo258,
We apologize for the inconvenience and glad that it works now.
We’ll keep this thread open so you can comeback when the next version of Enfold is released.Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.