stock-locations-for-woocommerce icon indicating copy to clipboard operation
stock-locations-for-woocommerce copied to clipboard

Replace ID with slug location for item meta

Open alexmigf opened this issue 4 years ago • 2 comments

From the beginning of this plugin the item meta has been always _stock_at_ID, but some users would benefit if instead of using the ID we use the term slug. Term slugs are also unique per setup, so would be good to replace that. Backwards compatibility must be granted, doing a migration or creating a function that does the conversion.

alexmigf avatar Mar 16 '21 18:03 alexmigf

Good to note, terms naming may change, where as ID wont. It is also possible to change the slug of a term which means there would need to be in-depth clean up processes to update now invalid meta data.

Maybe Internally its all handled via ID but there is a function to get the stock via the term slug. Somthing like.

$object->stockAt('location-1');

shanerutter avatar Mar 22 '21 15:03 shanerutter

You're right, great point and suggestion.

alexmigf avatar Mar 22 '21 21:03 alexmigf