Hi I have this issue with a shop.
I used this approach in other shops without any problem, I can’t set and change the compare_at_price fields to run some promotion in sync with my ERP.
I used two approaches for the python API:
def SetPromoVariant(shopify, variant_id, promo, price):
v = shopify.Variant.find(variant_id)
v.price = promo
v.save()
v.compare_at_price = price
v.save()
or
def SetPromoVariant(shopify, variant_id, promo, price):
v = shopify.Variant.find(variant_id)
v.price = promo
v.compare_at_price = price
v.save()
or
def SetPromoVariant(shopify, variant_id, promo, price):
query = """mutation productVariantUpdate($input: ProductVariantInput!) {
productVariantUpdate(input: $input) {
productVariant {
id
title
inventoryPolicy
inventoryQuantity
price
compareAtPrice
}
userErrors {
field
message
}
}
}"""
result = shopify.GraphQL().execute(
query=query,
variables={
"input": {
"id": f"gid://shopify/ProductVariant/{variant_id}",
"price": f"{promo}",
"compareAtPrice": f"{price}"
}
})
print(result)
N.B. The promo is bigger than the price, and every call return a success message, but the prices on the sites still not updated.
Did someone notice the same issue?