如何在WooCommerce中的特定国家/地区加载默认签出表单?

时间:2017-04-23 08:45:10

标签: wordpress forms woocommerce hook-woocommerce

我不想在检测到的特定国家/地区加载自定义结帐表单。无论如何都要这样做。以下是我的代码。

if($config['applicable-countries'] =='all'){

            load my custom check out form;

}
else if($config['applicable-countries'] =='speific country'){

                load default check out form;

    }

1 个答案:

答案 0 :(得分:0)

您可以使用get_template_part()

<?php
  if($config['applicable-countries'] == 'all') {
    get_template_part( $slug, $name );
  }

  else if($config['applicable-countries'] == 'speific country') {
    get_template_part( $slug, $name );
  }
?>


或者您可以使用简单的PHP包含 -

<?php
  if($config['applicable-countries'] == 'all') {
    include_once "checkout.php";
  }

  else if($config['applicable-countries'] == 'speific country') {
    include_once "checkout.php";
  }
?>