• Resolved JeanP

    (@jeanp)


    Hi There,

    I have created a Reusable block with this content:

    <!– wp:woocommerce/product-best-sellers {“rows”:1,”categories”:[58,60]} /–>

    I would like to change the categories that are displayed in this woocommerce product bestsellers block using a REST API Post call. For instance 58 & 60 should change to 40 & 41

    This is how I have set up the rest API POST call:

    URL: https://your-wordpress-site.com/wp-json/wp/v2/blocks/800
    Method: POST
    Body: {“content”: “<!– wp:woocommerce/product-best-sellers {“rows”:1,”categories”:[40,41]} /–>”}

    I can change the title of the block with an API call. But I haven’t been able to edit the content of the block.

    How should I set up the Body of the API Call to edit the category ID??

    For reference, here you can find the GET call of the block: https://www.webpagescreenshot.info/#v2=bgajAQsHH

    • This topic was modified 2 years, 8 months ago by JeanP.
    • This topic was modified 2 years, 8 months ago by JeanP.
    • This topic was modified 2 years, 8 months ago by James Huff.
    • This topic was modified 2 years, 8 months ago by James Huff.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey @jeanp,

    Thanks for providing all of the details in your post. I’m not seeing anything that appears to be off. We tend to deal with questions regarding the WooCommerce REST API and Store API and not so much with core WordPress API issues. While this is a WooCommerce block you’re updating, it’s using core WordPress methods.

    You may want to try one of these places for help. They tend to be better places to ask developer-focused questions than the forum. More developers tend to “hang out” there than they do in the forums.

    If you’re able to find the answer, please do post it here so that if anyone else needs to know this in the future, they’ll be able to find it. I’ll leave this thread open for a while to see if anyone is able to help too.

    Seems we’ve not had additional inputs on this thread. Thus, we encourage you to make use of the above resources.

    I’ll go ahead and mark the thread closed but please feel free to create a new thread if you have further questions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Edit Reusable Block content using Json REST API POST call’ is closed to new replies.