在我们的WooCommercestore pewne.eu上,为了涵盖发货,我们使用Apaczka plugin来处理我们的客户可用的不同发货方式-包括包裹机器-使用ApaczkaProvider 的API.

  1. 顾客可 Select "Paczkomat InPost"和"Orlen Paczka"包裹自动售货机.
  2. Select 其中之一即可在 map 上 Select 特定的包裹自动售货机...
  3. 及其数据:

choosing parcel machine

当您查看订单时,选定的包裹机数据将填充到WooCommerce后端:

admin view, data marked red

不幸的是,这些数据不会进入订单确认邮箱.

试图寻找任何类似的问题,但没有喜悦.此外,没有php方面的专业知识也于事无补.我可以看到包裹机器的数据显示在 checkout 页面上的div id=selected-parcel-machine广告在管理员端,它以某种方式被放入div class="order_data_column".不幸的是,我不知道如何利用这些知识做出任何有用的事情.

也许有人已经在处理类似的事情了?任何帮助都是非常感激的.

推荐答案

要在邮箱通知上显示投递点(如果存在),请使用以下方法:

add_action('woocommerce_email_after_order_table', 'display_delivery_point_on_email_notifications', 10, 1);
function display_delivery_point_on_email_notifications( $order ) {
    if ( $delivery_point = $order->get_meta('apaczka_delivery_point') ) {
        echo '<style>
        .delivery-point table{width: 100%; font-family: \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif;
            color: #737373; border: 1px solid #e4e4e4; margin-bottom:8px;}
        .delivery-point table th, .delivery-point table td{text-align: left; border-top-width: 4px;
            color: #737373; border: 1px solid #e4e4e4; padding: 12px;}
        </style>';

        echo '<div class="delivery-point"><h2>'.__('Delivery Point', 'woocommerce').'</h2>';
        echo '<table cellspacing="0" cellpadding="6"><tbody>';
        echo '<tr"><td>'.esc_attr($delivery_point['apm_access_point_id'])
        . ' (' . esc_attr($delivery_point['apm_supplier']) . '. ' . esc_attr($delivery_point['apm_name']) . ')'.'</td></tr>';
        echo '</tbody></table></div><br>';
    }
}

代码位于您的子主题的unctions.php文件中(或在插件中).应该能行得通.

Note: Found the displayed Delivery point on Admin single order in:
plugins > apaczka-pl > src > Plugin.php from line number 89 to 106.

Php相关问答推荐

Woocommerce自定义变体html表仅显示带值的列

照明\Support\Collection::Filter():参数#1($Callback)的类型必须为?可调用、已给定数组、已调用

WooCommerce基于元数据的自定义范围目录排序

PHP:PHP手册-Manual

WooCommerce:在 checkout 审核单和发票中显示定制产品数据

PHP空数组定义与开始或结束逗号

WooCommerce在购买后多次重定向

如何使用 PHP 创建简化的 twig 替换?

在 PHP MySQL 中自动生成账单编号

MongoDB Laravel Jenssegers 包:插入数据库时​​未定义的类常量PRIMARY

使用 wp_footer 挂钩添加一些 CSS 不起作用

PHP 中的 libgd 无法读取 Apache 配置中的 SetEnv GDFONTPATH

在PHP WordPress插件中使用变量连接路径时的问题解决方法

设置GA4 PHP API的setSubject以允许访问所有管理员账户属性

Laravel的Storage::exists返回false,而file_exists返回true.

php/html OnSubmit 禁用输入类型提交未给出预期结果

我试图在我的视图上显示从数据库中获取的数据,但我无法显示它.拉维尔 10.x /

PHP 中的正则表达式,具有字符范围,但不包括特定字符

如何在 Laravel 中验证多个输入?

标头内容类型:image/jpeg 无效