Skip to content

Instantly share code, notes, and snippets.

@wp126
Created September 14, 2022 08:33
Show Gist options
  • Save wp126/7c600eee33965014cc2be6f63e349417 to your computer and use it in GitHub Desktop.
Save wp126/7c600eee33965014cc2be6f63e349417 to your computer and use it in GitHub Desktop.
update stock and price in woocommerce
<?php
$product = new WC_Product( 5 );
$product->set_price( 10 );
$product->set_stock_quantity(3 );
$product->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment