我想同时在 WooCommerce 购物车和结帐页面中显示使用高级自定义字段插件创建的自定义字段的值。
我在functions.php我的主题页面中使用以下代码,该代码仅显示在产品的单个页面中:
add_action( 'woocommerce_before_add_to_cart_button', 'add_custom_field', 0 );
function add_custom_field() {
global $post;
echo "<div class='produto-informacoes-complementares'>";
echo get_field( 'info_complementar', $product_id, true );
echo "</div>";
return true;
}
Run Code Online (Sandbox Code Playgroud)
感谢大家提供的所有帮助,并请原谅我的英语。