Support » Plugin: WooCommerce » API: Create a product category with custom meta data

  • Resolved joseconstela



    Is it possible to create a product category via de API and add some metadata to it? I don’t mind if the metadata is added on the same request that creates the category or in a different request (to both WC and WP apis).

    is there any action / hook to do this?


Viewing 1 replies (of 1 total)
  • joseconstela


    Woop! solution found: please note I’m using ACF plugin for storing metadata.

    function create_category( $term, $req, $creation ) {
      $params = $req->get_params(); // holds the request body
      update_field('key', 'value', 'product_cat_'.$term->term_id);
    add_action( 'woocommerce_rest_insert_product_cat', 'create_category', 10, 3);
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.