Similarly you can use unset($columns['abc']) to remove a column.
I want to let you know that we have already tried to remove columns which could be problematic and we put in some protections there. For example we removed columns such as 'Featured', upsells, cross-sells etc.
Hi
Is it possible to limit (programmatically) the CSV product import and export columns based on a specific vendor group?
I have looked at this github repository for guidelines in terms of customisation and can only see the possibility of adding custom columns and nothing on removing/disabling columns. https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Importer-&-Exporter#adding-custom-export-columns-developers
The reason for this is that we want to limit the control a vendor group has over what product fields they can edit/import in bulk.
Any suggestions that can point me in the right direction would be greatly appreciated.
Regards
Victor
Hi Victor,
To remove columns during export for vendors, you can use this sample code snippet:
What this snippet does is that it removes the vendor_id column during export for vendors.
You would need to look at that $columns variable to see the exact names (Slugs) of each column.
During import, you can use the following:
Similarly you can use unset($columns['abc']) to remove a column.
I want to let you know that we have already tried to remove columns which could be problematic and we put in some protections there. For example we removed columns such as 'Featured', upsells, cross-sells etc.
Kind regards,
Stefan
Perfect
Thank you Stefan