• Resolved Allyson

    (@allysonsouza)


    Hi, I’ve tried to search in the docs and on the internet but wasn’t able to find anything. How can I modify or add data to REST response for product_invalid_sku?

    I want to retrieve the product SKU, like that:

    {
      "code": "product_invalid_sku",
      "message": "REF inválido ou duplicado.",
      "data": {
        "status": 400,
        "resource_id": 1111
        "sku": "00s0s9d0s9218"
      }
    }

    Any idea about the right hooks to do that? I’m using REST API v3.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support kellymetal a11n

    (@kellymetal)

    Hi there!

    Changing the set_sku function in the /woocommerce/includes/abstracts/abstract-wc-product.php file to include the SKU would work, however making changes to core files is not recommended as the changes will be lost whenever the plugin is updated. There does not seem to be a filter available for filtering the response there.

    You could create an enhancement request to include the SKU in the REST API response in the core WooCommerce plugin repository here:
    https://github.com/woocommerce/woocommerce/issues/new/choose

    I hope that helps!

    Thread Starter Allyson

    (@allysonsouza)

    Thanks for your reply! We solved our problem in another way, but maybe it could be a great addition.-

    Plugin Support kellymetal a11n

    (@kellymetal)

    Hi there,

    I’m glad to hear you were able to find a solution to the problem! : )

    I’m going to mark this thread as resolved. If you have any further questions, please start a new thread.

    Have a wonderful day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Additional data to REST responses (REST v3)’ is closed to new replies.