Unprocesable enity error....

Highlighted
Excursionist
20 0 4

...when cresting price rule if any entitled variant is provided. 

 

Lets say im calling price rule api with 

 

{
target_type: "line_item",
target_selection: "all",
allocation_method: "across",
customer_selection: "all",
starts_at: new Date(),
title: myTile, 
value_type: automaticDiscount.type,
value: `${-1 * automaticDiscount.value}`,
entitled_variant_ids: [],
usage_limit: 1,
allocation_limit: 1,
}
everything works. But if i add any variant to entitled_variant_ids then 422- Unprocessable entity is thrown. 
 
0 Likes
Highlighted
Shopify Staff
Shopify Staff
587 71 128

Hey @greg12,

 

If you want to include specific variants when creating a price rule, you need to use target_selection of entitled (instead of all). This is also outlined in our PriceRule docs:

 

20-02-b7a72-dv5b7

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes