У меня есть какая -то работа по коду, в котором отображается сообщение в верхней части упаковочных проскальзываний, если у нас есть новый клиент. < /p>
Однако он показывает сообщение для всех заказов, поэтому Я подумал, что мой код не получает правильную информацию от Woocommerce, чтобы подтвердить, если клиент ранее разместил заказ.
Мы тоже используем HPO. />function action_wpo_wcpdf_after_document_label( $wpo_wcpdf_export_template_type, $order ) {
if ('packing-slip' != $wpo_wcpdf_export_template_type) { return; }
$billing_email = $order->get_billing_email();
if (!$billing_email) {
return;
}
$customer_orders = get_posts( array(
'numberposts' => -1,
'exclude' => array($order->get_id()),
'meta_key' => '_billing_email',
'meta_value' => $billing_email,
'post_type' => wc_get_order_types(),
'post_status' => array_keys( wc_get_order_statuses() ),
) );
if (empty($customer_orders)) { print "\n" . '
New Customer
' . "\n"; return; }
else { print "\n" . '
Existing Customer
' . "\n"; return; }
return;
}
add_action( 'wpo_wcpdf_after_document_label', 'action_wpo_wcpdf_after_document_label', 10, 2 );
Подробнее здесь: https://stackoverflow.com/questions/793 ... oocommerce