Jake Vanderwerf
2026-02-04 2127b1bdd73ecd2423e443992da4b442f5a3c1a3
inc/integrations/Helcim.php
@@ -1,7 +1,7 @@
<?php
namespace JVBase\integrations;
use JVBase\meta\MetaManager;
use JVBase\meta\Meta;
use Exception;
use WP_Error;
use WP_REST_Request;
@@ -666,7 +666,7 @@
            $post = get_post($post_id);
            if (!$post) continue;
            $meta = new MetaManager($post_id, 'post');
            $meta = Meta::forPost($post_id);
            $field_map = $this->field_mappings[$post->post_type] ?? [];
            // Prepare product data for Helcim
@@ -675,12 +675,12 @@
               'description' => $post->post_content,
               'productCode' => get_post_meta($post_id, BASE . '_helcim_product_code', true) ?: 'WP-' . $post_id,
               'type' => $content_type,
               'price' => floatval($meta->getValue('price')) * 100, // Convert to cents
               'taxable' => (bool)$meta->getValue('is_taxable'),
               'price' => floatval($meta->get('price')) * 100, // Convert to cents
               'taxable' => (bool)$meta->get('is_taxable'),
            ];
            // Handle variations
            $variations = $meta->getValue('product_variations');
            $variations = $meta->get('product_variations');
            if (!empty($variations)) {
               $product_data['variations'] = $this->prepareVariations($variations);
            }
@@ -838,7 +838,7 @@
      if ($post_id) {
         // Update meta data
         $meta = new MetaManager($post_id, 'post');
         $meta = Meta::forPost($post_id);
         $meta->setAll([
            'price' => $product['price'] / 100, // Convert from cents
            '_helcim_product_id' => $product['productId'],
@@ -1228,8 +1228,8 @@
         $post_id = intval($item['id'] ?? 0);
         if (!$post_id) continue;
         $meta = new MetaManager($post_id, 'post');
         $price = floatval($meta->getValue('price'));
         $meta = Meta::forPost($post_id);
         $price = floatval($meta->get('price'));
         $quantity = intval($item['quantity'] ?? 1);
         $total += ($price * $quantity * 100); // Convert to cents
@@ -1254,12 +1254,12 @@
         if (!$post_id) continue;
         $post = get_post($post_id);
         $meta = new MetaManager($post_id, 'post');
         $meta = Meta::forPost($post_id);
         $line_items[] = [
            'description' => $post->post_title,
            'quantity' => intval($item['quantity'] ?? 1),
            'price' => floatval($meta->getValue('price')) * 100,
            'price' => floatval($meta->get('price')) * 100,
            'productCode' => get_post_meta($post_id, BASE . '_helcim_product_code', true) ?: 'WP-' . $post_id
         ];
      }