是否可以在 woocommerce 结帐时为不同的产品添加不同的条款和条件页面?如果订单有一些特定的产品,我需要显示不同的 T&C 页面。
管理员无法做到这一点,因此我将覆盖payment.php
模板中的插件文件并针对以下部分进行破解
<?php if ( wc_get_page_id( 'terms' ) > 0 && apply_filters( 'woocommerce_checkout_show_terms', true ) ) : ?>
<p class="form-row terms">
//If condition here
<label for="terms" class="checkbox"><?php printf( __( 'I’ve read and accept the <a href="%s" target="_blank">terms & conditions</a>', 'woocommerce' ), esc_url( wc_get_page_permalink( 'terms' ) ) ); ?></label>
<input type="checkbox" class="input-checkbox" name="terms" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms'] ) ), true ); ?> id="terms" />
</p>
<?php endif; ?>
在文件中是否有任何钩子可以做到这一点functions.php
?