简体   繁体   English

WooCommerce Rest API-woocommerce_api_invalid_remote_product_image

[英]WooCommerce Rest API - woocommerce_api_invalid_remote_product_image

I am currently using this API: https://github.com/kloon/WooCommerce-REST-API-Client-Library to automatically keep my products upto date from several different data feeds. 我目前正在使用以下API: https : //github.com/kloon/WooCommerce-REST-API-Client-Library可以通过几种不同的数据源自动使我的产品保持最新状态。

I have been using the package for a few weeks now but since upgrading my WooCommerce version to 2.4.7 I have been having issues. 我已经使用该软件包了几个星期,但是自从将WooCommerce版本升级到2.4.7以来,我一直遇到问题。

I use the feed to create products from several feeds but since the update I am getting an error when trying to upload images: woocommerce_api_invalid_remote_product_image 我使用提要从多个提要中创建产品,但是由于更新,尝试上传图像时出现错误:woocommerce_api_invalid_remote_product_image

The code has not changed and has worked for several weeks before the upgrade, images were automatically synced with the media section. 代码未更改,并且在升级前已经工作了几周,图像已自动与媒体部分同步。

Below is the structure of the data I use which is passed into the following line: print_r($client->products->create($data)); 下面是我使用的数据结构,该结构传递到以下行中: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] => ) ) ) )

I have changed some of the data above to keep it short. 我已经更改了上面的一些数据以使其简短。 The images don't seem to be uploading (which is throwing out the error) and there is also an issue with Categories and Tags not being set. 图片似乎没有上传(这抛出了错误),并且还存在未设置类别和标签的问题。 Once again to reiterate I have not changed any code since the update. 再次重申,自更新以来,我没有更改任何代码。

Have tested the following data structure against WooCommerce 2.4.7 and it works fine 已针对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