How do I replace sku with product id?
-
Hi,
I use a feed from a manufacturer to upload to a WooCommerce custom field.
The custom field expects a product id as input, but the feed is not aware of this.
I use sku as the key to compare existing products with the feed.The imported field is called {metaparent_sku[1]} and the content has several values separated by | , for example:
BDCD7 | BDAUX | BDCA1 | ADUP89
These are unique product sku’s referring to products already in WooCommerce.What I’d like to do is replace the sku value with the corresponding product ID value in as it exists already in WooCommerce.
I’ve been trying to use
str_replace
but can’t figure out how to set it up.Could you help?
- The topic ‘How do I replace sku with product id?’ is closed to new replies.