Reply 355982 to: How do I show ACF (Advanced custom fields) in frontend of single product page?

Avatar: Rose Tyler
Rose Tyler
Support staff
May 8, 2023 at 15:59

Hello, Shubh,

Thank you for your response.

This is a matter of additional customization – which you can do on the resource – https://wpkraken.io/ .

If you want to do it yourself, the modification greatly depends on whether you use the single product builder. If you are using it, then you need to learn WooCommerce’s hook system, some of which you can check out by following the link – https://www.businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/

If you are not using the builder, in addition to hook, depending on the customization, you will also need to rewrite some of the following files in the child theme
wp-content\themes\xstore\woocommerce\single-product\product-image.php
wp-content\themes\xstore\woocommerce\single-product\related.php
wp-content\themes\xstore\woocommerce\single-product\title.php
wp-content\themes\xstore\woocommerce\single-product\up-sells.php
wp-content\themes\xstore\woocommerce\single-product\bought-together.php
wp-content\themes\xstore\woocommerce\single-product\meta.php
wp-content\themes\xstore\woocommerce\single-product\add-to-cart\simple.php
wp-content\themes\xstore\woocommerce\single-product\tabs\single-product-builder-tabs.php
wp-content\themes\xstore\woocommerce\single-product\tabs\tabs.php

In order to take the value of the option added to the product using the ACF (Advanced custom fields) plugin
you can use the following code
get_field(‘your option kay’, $id);
where $id is the ID of the product on which the code is executed

it is also desirable to use construction
$value = (function_exists(‘get_field’) ) ? get_field(‘your option kay’, $id) : ‘default value’;
to prevent errors when disabling or updating the ACF (Advanced custom fields) plugin.

We hope this information is helpful.

Please note that additional customization in files is outside the scope of our basic support. Also, we can’t be responsible for your custom coding.

Kind Regards,
8theme team

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.