Я получаю сообщение об ошибке в вызове cURL для правила цены на основе выбранных продуктов.Вот моя ошибка:
{
"errors":{
"price_rule":"Required parameter missing or invalid"
}
}
Ниже приведены параметры моего тела, которые я отправляю при вызове cURL:
{
"price_rule":{
"title":"sss",
"target_type":"line_item",
"target_selection":"entitled",
"allocation_method":"across",
"value_type":"fixed_amount",
"value":"-434",
"customer_selection":"all",
"prerequisite_quantity_range":{
"greater_than_or_equal_to":"2"
},
"entitled_product_ids":{
"0":"2397130326093",
"1":"2397129965645",
"2":"2397131898957",
"3":"2397132324941"
},
"starts_at":"2019-02-22T08:08:53.000Z"
}
}
Ниже приводится мой вызов cURL:
$ch = curl_init();
// curl_setopt($ch, CURLOPT_POST, count($newrule));
curl_setopt($ch, CURLOPT_URL, $access_token_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($pro_ids11));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Shopify-Access-Token: '.$shops_token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
if (curl_error($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);
if (isset($error_msg)) {
echo $error_msg;
}
Обратите внимание, что я работаю в PHP.Заранее спасибо!