wc_update_product_stock_status( int $product_id, string $status )
Update a product’s stock status.
Description Description
Parameters Parameters
- $product_id
-
(Required) Product ID.
- $status
-
(Required) Status.
Source Source
File: includes/wc-stock-functions.php
77 78 79 80 81 82 83 | function wc_update_product_stock_status( $product_id , $status ) { $product = wc_get_product( $product_id ); if ( $product ) { $product ->set_stock_status( $status ); $product ->save(); } } |