Hey there,
I am trying to do a productVariantsBulkUpdate mutation to remove a compareAtPrice (setting it to null), but it seems to be ignored. Possibly json serialization excluding any properties that are null?
Just wondering what the best way is to remove a compare at price on a variant?
var productVariantsBulkUpdateInputList = new List<ProductVariantsBulkInput>();
var productVariantsBulkUpdateInput = new ProductVariantsBulkInput
{
id = productVariant.id,
price = itemPrice,
compareAtPrice = null
};
productVariantsBulkUpdateInputList.Add(productVariantsBulkUpdateInput);
var graphRequest = new GraphRequest
{
Query = """
mutation ($productId: ID!, $variants: [ProductVariantsBulkInput!]!){
productVariantsBulkUpdate(
productId: $productId
variants: $variants
) {
__typename
product {
__typename
id
}
userErrors {
__typename
field
message
code
}
}
}
""",
Variables = new Dictionary<string, object>
{
{ "productId", shopifyProduct.id },
{ "variants", productVariantsBulkUpdateInputList }
}
};
await graphService.PostAsync<ProductVariantsBulkUpdateResult>(graphRequest);
Hey there,
I am trying to do a productVariantsBulkUpdate mutation to remove a compareAtPrice (setting it to null), but it seems to be ignored. Possibly json serialization excluding any properties that are null?
Just wondering what the best way is to remove a compare at price on a variant?