繁体   English   中英

WooCommerce Rest API-woocommerce_api_invalid_remote_product_image

[英]WooCommerce Rest API - woocommerce_api_invalid_remote_product_image

我目前正在使用以下API: https : //github.com/kloon/WooCommerce-REST-API-Client-Library可以通过几种不同的数据源自动使我的产品保持最新状态。

我已经使用该软件包了几个星期,但是自从将WooCommerce版本升级到2.4.7以来,我一直遇到问题。

我使用提要从多个提要中创建产品,但是由于更新,尝试上传图像时出现错误:woocommerce_api_invalid_remote_product_image

代码未更改,并且在升级前已经工作了几周,图像已自动与媒体部分同步。

下面是我使用的数据结构,该结构传递到以下行中:print_r($ client-> products-> create($ data));

$data = Array ( [product] => Array ( [title] => Title1 [type] => external [sku] => 369100007 [product_url] => valiurl [regular_price] => 999.99 [sale_price] => [description] => Description [categories] => Array ( [0] => Main Cat [1] => Sub Cat ) [images] => Array ( [src] => validimageurl [position] => 0 ) [tags] => Array ( [0] => Tag1) [attributes] => Array ( [0] => Array ( [name] => Color [slug] => color [position] => 0 [visible] => 1 [options] => ) ) ) )

我已经更改了上面的一些数据以使其简短。 图片似乎没有上传(这抛出了错误),并且还存在未设置类别和标签的问题。 再次重申,自更新以来,我没有更改任何代码。

已针对WooCommerce 2.4.7测试了以下数据结构,并且工作正常

$client->products->create( array( 
        'title' => 'External',
        'sku' => 'ext001', 
        'type' => 'external', 
        'regular_price' => '100',
        'product_url' => 'http://www.example.com',
        'description' => 'This is external product', 
        'sale_price' => '80', 
        'weight' => '15',
        'images' => Array ( '0' => Array( 'src' => 'http://placehold.it/150x150.jpg', 'title' => '21', 'position' => '0' ) ),       
        'description'=>'This is the description',
        'categories' => Array( 32, 30 ),
        'tags' => Array( 82 ),
        'short_description'=>'Short Description',
        'enable_html_short_description' => true,
        'attributes' => array( array( 'name'=>'color','slug'=>'color','type'=>'text','options'=> array('red','white'),'variation'=>'false') ),
       )  ); 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM