API REST WooCommerce – Metas and ACF with product categories
-
Hi !
I’m facing an issue with the API REST. I’m trying to use a PUT request to modify the values of my metas (meta title, meta description, og meta title, og meta description, twitter meta title, twitter meta description), and an ACF field. Like the title says, i’m trying to do that for my product categories (I already succeeded doing it for my products).
The thing is, no matter what I use as JSON body, nothing works. I tried something like this (which is the information returned by the GET request) for my ACF field (I already downloaded the “ACF to REST API” plugin) :
{
“yoast_head_json”: {
“title”: “{{ $json.different[‘TITRE SEO’].inputA }}”,
“description”: “{{ $json.different[‘META DESCRIPTION’].inputA }}”,
“og_title”: “{{ $json.different[‘TITRE SEO’].inputA }}”,
“og_description”: “{{ $json.different[‘META DESCRIPTION’].inputA }}”,
“twitter_title”: “{{ $json.different[‘TITRE SEO’].inputA }}”,
“twitter_description”: “{{ $json.different[‘META DESCRIPTION’].inputA }}”
},
“fields”: {
“texte_de_referencement”: “{{ $json.different[‘TXT REF’].inputA }}”,
“titre_h1”: “{{ $json.different[‘H1 REF’].inputA }}”
}
}For my ACF fields I also tried this :
{
“acf”: {
“titre_h1”: “{{ $json.different[‘H1 REF’].inputA }}”
}
}(I’m trying with dynamic informations, but it won’t work with static informations either).
The url i’m using is https://www.mywebsite.com/wp-json/wc/v3/products/categories/product_cat_id and of course I have the right credentials (which allowed me to do the same, but successful request for my products “https://www.mywebsite.com/wp-json/wc/v3/products/product_id”).
Am I missing something ?
I also tried something like this, but still won’t work :
{
“meta_data”: [
{
“key”: “h1_title”,
“value”: “Updated H1 Title”
}
]
}Is it something impossible for now ?
- You must be logged in to reply to this topic.