如何使用shopify api从集合中删除产品

时间:2018-05-21 12:19:35

标签: collections e-commerce shopify product

https://wetion.myshopify.com/admin/collects/.jsonproduct_id=9706757444&collection_id=380751892';
我需要从集合中删除产品。可能吗?

$delete_exist_collect =  array();
for($i=0 ; $i < $custom_collectionss ; $i++)
{
    $delete_exist_collect = $product_data_collection['custom_collections'][$i]['id'];
    $urli = $to_storeurl_shopify.'/admin/collects/.json?product_id='.$response->product->id.'&collection_id='.$delete_exist_collect;    
    echo $urli;
    $newurl = str_replace(" ","",$urli);
    $shopcurl = curl_init();
    curl_setopt($shopcurl, CURLOPT_URL, $newurl);
    curl_setopt($shopcurl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    curl_setopt($shopcurl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($shopcurl, CURLOPT_USERPWD,$to_shopify_u_p);
    curl_setopt($shopcurl, CURLOPT_CUSTOMREQUEST, 'DELETE');
    curl_setopt($shopcurl, CURLOPT_SSL_VERIFYPEER, false);
    $responsee = curl_exec ($shopcurl);
    curl_close ($shopcurl);         
    $product_data_collection = json_decode($responsee,TRUE);
}

0 个答案:

没有答案