我有一个WooCommerce网站,在"单一产品"页面中,我有一个自定义复选框,用于在"添加到购物车"按钮之前同意条款,但我正在try 在仪表板中添加一个true/false字段,以便将该复选框移到页面上的其他位置.
我的函数如下所示:
add_action( 'acf/init', "acf_move_checkbox", 10 );
function acf_move_checkbox() {
$move_cart = get_field('move_cart');
if ($move_cart) {
add_action( 'woocommerce_after_single_product', "acf_product_terms", 10 );
} else {
add_action( 'woocommerce_before_add_to_cart_form', "acf_product_terms", 10 );
}
// More code
}
什么都没发生,我的 idea 是对的还是错了?