And get the specific variant I want to work with but is there any way to say SetValue("price", MyValue) for the variant specifically.
Ideally im looking for how I can make a variant mutable and not just read only per se.
I was hoping it would be treated just like a node and you could set such things like this but I am having no luck at the moment...
Short of generating the entire json string for all of the variants on the parent node (which I really don't want to have to go through lol) im not finding another way
Unfortunately not. The variants property editor is based off Umbraco's block list editor and because of this ultimately all the variants data is stored within one field on the parent node. As such, this does mean you'll have to deal with them as an entire block and save it back to the parent and then save the parent.
Hopefully this will change in future as we ensured it was based on the block lists editor as there was talk in HQ about making these be persisted as nodes at some point. When that happens, then you may be able to deal with them directly, but for now, you'll have to work with them as a whole.
Set Variant Price Programmatically
Matt,
I am working on writing a simple Price updater for the products within Vendr.
Getting and updating the parent product Price is easy and already completed.
Is there a way to get the product price for a complex variant?
I can do something like this:
And get the specific variant I want to work with but is there any way to say
SetValue("price", MyValue)
for the variant specifically.Ideally im looking for how I can make a variant mutable and not just read only per se.
I was hoping it would be treated just like a node and you could set such things like this but I am having no luck at the moment...
Short of generating the entire json string for all of the variants on the parent node (which I really don't want to have to go through lol) im not finding another way
Thanks.
Hi Kyle,
Unfortunately not. The variants property editor is based off Umbraco's block list editor and because of this ultimately all the variants data is stored within one field on the parent node. As such, this does mean you'll have to deal with them as an entire block and save it back to the parent and then save the parent.
Hopefully this will change in future as we ensured it was based on the block lists editor as there was talk in HQ about making these be persisted as nodes at some point. When that happens, then you may be able to deal with them directly, but for now, you'll have to work with them as a whole.
Matt,
I was leaning that way and prepared to go down the non editable road but had to make sure I wasn’t missing something.
All the best, Kyle
is working on a reply...