Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using an ID when creating Variation Attribute (or anything really) doesn't work #771

Open
dmainmon opened this issue Jan 24, 2024 · 0 comments

Comments

@dmainmon
Copy link

          I think you need to pass attribute ID in vatrib.

Originally posted by @XiaoFaye in #436 (comment)

I think you need to pass attribute ID in vatrib.

Anytime I specify an id when adding a Variation Attribute (or anything really), nothing gets added. If I use 0 or omit the id, It gets added.
The code below doesn't work (no error message, just doesn't add the Variation Attribute).

Variation newVariation = variant;
newVariation.attributes = new List<VariationAttribute>()
 {
      new VariationAttribute()
       {            
            id=99,          // THIS DOES NOT WORK          
           name="Options",
           option= Variants[count]
       }
 };
 var upVar = wc.Product.Variations.Update((ulong)variant.id, newVariation, Convert.ToUInt32(RecID));

The next section code adds works but there's no id or it's 0. Anything else and it never get's added.

Variation newVariation = variant;
newVariation.attributes = new List<VariationAttribute>()
 {
      new VariationAttribute()
       {                                
           name="Options",
           option= Variants[count]
       }
 };
 var upVar = wc.Product.Variations.Update((ulong)variant.id, newVariation, Convert.ToUInt32(RecID));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant