WooCommerce - 根据客户选择的国家/地区更改发票上的商店地址

时间:2021-07-18 07:59:16

标签: php pdf woocommerce invoice

我正在使用 WooCommerce PDF Invoices 插件创建发票。

问题: 我需要根据客户在结帐页面上选择的国家/地区更改发票上的商店地址。

我没有找到可行的解决方案,目前我做了这个例子:

$customer_shipping_country = WC()->customer->get_shipping_country();
if(!empty($customer_shipping_country)){
   if ($customer_shipping_country == "England") {
      //change shop address to x
   } elseif ($customer_shipping_country == "France") {
      //change shop address to y
   }
}

我是在正确的轨道上还是?

a) 更改发票模板

b) 在 functions.php 中构建一个钩子

0 个答案:

没有答案
相关问题