• Resolved marccie

    (@marccie)


    Hello,

    we have the problem that when we want to change a product with endpoint

    -X PUT https://WP-SITE.COM/wp-json/wp/v2/products/ID

    We see the value in de result JSON but we don’t see the value on the website.

    “meta_data”: [
    {
    “id”: 9994,
    “key”: “yikes_woo_products_tabs”,
    “value”: [
    {
    “id”: “support-faq”,
    “title”: “Support & FAQ”,
    “value”: “<span style=\”font-family: ‘Arial’;font-weight: bold;\” >Test<br/></span><span style=\”\” ><br/>This is a value</span>”
    }
    ]
    },`

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @marccie,

    Depending on your site’s configuration, you may need to register the field with the rest API..

    If you inspect the meta key in your site’s database, do you see that the value has been changed?

    Let me know what you find,
    Jon

    Thread Starter marccie

    (@marccie)

    @jpowersdev This is what I sand

    {
    “meta_data” :
    [
    {
    “key” : “yikes_woo_products_tabs”,
    “value” :
    [
    {
    “id” : “support-faq”,
    “title” : “Support & FAQ”,
    “value” : “<span style=\”font-family: ‘Arial’;font-weight: bold;\” >Test<br/></span><span style=\”\” ><br/>This is a value</span>”
    }
    ]
    }
    ],
    }

    and this is de response:

    {
    “meta_data”: [
    {
    “id”: 9993,
    “key”: “_last_editor_used_jetpack”,
    “value”: “classic-editor”
    },
    {
    “id”: 9994,
    “key”: “yikes_woo_products_tabs”,
    “value”: [
    {
    “id”: “support-faq”,
    “title”: “Support & FAQ”,
    “value”: “<span style=\”font-family: ‘Arial’;font-weight: bold;\” >Test<br/></span><span style=\”\” ><br/>This is a value</span>”
    }
    ]
    },
    {
    “id”: 9996,
    “key”: “_wp_page_template”,
    “value”: “default”
    }
    ],
    }

    On the frontend I can see the TAB Support & FAQ but with no content.

    Hi @marccie,

    The key for the tab’s content is “content”, but it looks like you are sending it as “value”. Try it like this:

    {
    “id” : “support-faq”,
    “title” : “Support & FAQ”,
    “content” : “<span style=\”font-family: ‘Arial’;font-weight: bold;\” >Test<br/></span><span style=\”\” ><br/>This is a value</span>”
    }

    Jon

    Thread Starter marccie

    (@marccie)

    Hi @jpowersdev,

    thanks a lot. That worked for me.

    Marc

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Cant change value with REST API’ is closed to new replies.