在 wordpress 中,有一个名为 woocommerce 的插件,它可以让网站开始销售各种产品。
我开设了一家 woocommerce
商店,但我需要在购买后立即添加联系表单来增强其功能。
事件链将是:
我有这段代码要放在主题代码中,但似乎没有找到:
add_action( 'template_redirect', 'woocommerce_redirect_after_checkout' );
function woocommerce_redirect_after_checkout() {
global $wp;
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
$redirect_url = 'https://businesscard.com/questionnaire/';
wp_redirect($redirect_url );
exit;
}
}
答案 0 :(得分:1)
您应该使用位于以下位置的functions.php文件修改您的子主题功能:
wp-content/themes/your-child-theme/