Closed MKI-Miro closed 1 year ago
When adding product tag, you should use ProductTag object.
But I want to link existing product with existing tag. But from wcobject I am only able to retrieve productTag and product object has only list of productTagLines
In this case, product.Update should be used, not product.tags.Add.
But again input for product update is Product object and this object has property tags which is type of ProductTagLine so i am not able to assign ProductTag Object
`var wc = new WCObject(rest);
var updatedProduct = wc.Product.Update(productId, product)`
ProductTag is for making changes to product tag ONLY, if you are updating product, please use ProductTagLine.
Thank you but I am still confused. Can you please provide small example how to connect exsiting product with exsitin tag?
@XiaoFaye great work. Thank you! I've the same issue & confusion as @MKI-Miro
Can someone help? This is not working
`// All slate manufacturers var slateTags = _slateProductTagRepository.GetAllTags(domain, wooKey, wooSecret);
var productTag = slateTags.FirstOrDefault(p => p.name == productInDb.Manufacturer.Name);
if (productTag != null) { productInSlate.tags.Add(productTag); // ERROR Cannot convert ProductTag to ProductTagLine }`
Make sure you have included the below details when open an issue. Thank you.
Wordpress version, WooCommerce version and WooCommerce.NET version V3api
Steps to replicate the issue
Hi
From WCObject I am only able to retrieve ProductTag object.
I want to add product tag to Product object. ProductTag object has property tags which is type of ProductTagLine.
How I am supposed to do it?
`var wc = new WCObject(rest); var items = wc.Tag.GetAll(); // Items of type productTags
product.tags.Add(items.FirstOrDefault(p => p.name == productInDb.Manufacturer.Name)); `
Error CS1503 Argument 1: cannot convert from 'WooCommerceNET.WooCommerce.v3.ProductTag' to 'WooCommerceNET.WooCommerce.v3.ProductTagLine'
Thanks