S
S
slavanek2020-07-19 15:30:28
WooCommerce
slavanek, 2020-07-19 15:30:28

Programmatic SKU entry in WooCommerce. Search doesn't work. What to do?

I fill the product in WooCommerce programmatically.
I create product records. The article is written using the function update_field('_sku', 'Value of the article', $ID)
The article is displayed in the admin panel. Also on the product page. But in the admin panel, the search by article does not work. If you go into editing the product and "Update" the search starts working.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pychev Anatoly, 2020-07-19
@slavanek

$product = wc_get_product( $ID );
$product->set_sku('Значение артикула');
$product->save();

Just be sure to handle exceptions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question