Setting passwords via the WooCommerce REST API
At the present time, the WooCommerce Protected Categories plugin does not provide native support for creating passwords via the REST API. However, you can hook into the category creation endpoint as follows:
add_action( 'woocommerce_rest_insert_product_cat', 'wc_rest_insert_protected_category', 10, 3 ); function wc_rest_insert_protected_category( $term, $request, $creating ) { if ( $creating ) { $password = '1234abcd'; add_woocommerce_term_meta( $term->term_id, 'password', esc_attr( $password ) ); } }
If searching the knowledge base hasn't answered your question, please contact support.