D
D
Denis99992020-09-21 16:13:31
WordPress
Denis9999, 2020-09-21 16:13:31

How to set variation name in woocommerce programmatically?

This is not a big code:

$variation_id = 6837;
$product_name = 'Product 1234 ';
$product = wc_get_product( $variation_id);
$product_name = $product->get_name();
$product->set_name($product_name . 'aaa1');
$product->save();


$product->get_name() - works, returns the name. The problem is that $product->set_name() doesn't work in any way. What did I write wrong here?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question