This commit is contained in:
2026-04-26 23:47:49 +02:00
parent 1b95f03d1e
commit b073e009d8
5288 changed files with 1112699 additions and 55536 deletions

View File

@@ -70,9 +70,16 @@ class EnrichOrder {
$pysData['last_pys_utm_id'] = isset($_REQUEST['last_pys_utm_id']) ? sanitize_text_field($_REQUEST['last_pys_utm_id']) : "";
$order = wc_get_order($order_id);
if($order) {
$order->update_meta_data("pys_enrich_data",$pysData);
$order->save();
if ( isWooCommerceVersionGte('3.0.0') ) {
// WooCommerce >= 3.0
if($order) {
$order->update_meta_data("pys_enrich_data",$pysData);
$order->save();
}
} else {
// WooCommerce < 3.0
update_post_meta( $order_id, 'pys_enrich_data', $pysData );
}
}

View File

@@ -1,11 +1,25 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
use function PixelYourSite\isWooUseHPStorage;
include_once "function-helper.php";
$order = wc_get_order($orderId);
$data = $order->get_meta("pys_enrich_data",true);
$dataAnalytics = $order->get_meta("pys_enrich_data_analytics",true);
$data = array();
$dataAnalytics = array();
if(isWooUseHPStorage()) {
// WooCommerce >= 3.0
if($order) {
$data = $order->get_meta( 'pys_enrich_data', true );
}
if($dataAnalytics && is_array($dataAnalytics) && is_array($data)) {
$data = array_merge($data,$dataAnalytics);
} else {
// WooCommerce < 3.0
if(get_post_meta($orderId, "pys_enrich_data", true))
{
$data = get_post_meta($orderId, "pys_enrich_data",true);
}
}
if($data && is_array($data)) :