マーチャントが新製品を追加するとき、通常のテキストを body_html フィールドに入力する限り、うまく機能します。ただし、コピーペーストまたは WYSIWYG エディター ("" を含む) への画像の追加から HTML を追加しようとすると、次のように有名になります。
字句エラー: json テキストに無効な文字があります。
今、彼らは不明なソースから貼り付けている可能性があります.ShopifyAPIに送信する前にbody_htmlをクリーンアップする方法を見つけた方法はありますか?
ちなみに、私はPHPとwcurl.php https://github.com/sandeepshetty/wcurlを使用しています
アップデート:
字句エラー: json テキストに無効な文字があります。
              "{"product":{"title":"Sample Event
    (right here) ------^
コードサンプル:
$shopify_data = array
(
   "product"=>array
   (
     "title"=>$rs->product_title,
     "body_html"=>$rs->product_details,
     "vendor"=>"My Companay",
     "product_type"=>"Laptop"
   )
);
foreach ($variant as $key => $value) {
  $shopify_data["product"]["variants"][$key] = array(
    "option1"=> $value->variant_name,
    "price"=> $value->price,
    "requires_shipping"=>'true',
    "inventory_management"=>"shopify",
    "inventory_quantity"=> $value->quantity
  );
}
// $shopify_data = json_encode($shopify_data);  // This does not work either.
$shopify_data = stripslashes(json_encode($shopify_data));