-
Hi,
I am creating and updating my woocommerce product using wc rest API
All fields creating and updating the product correctly
But it not showing the fields _math_rank_seo_focus_keyword, _math_rank_seo_title, _math_rank_seo_description.for doing this write this sample code:
from woocommerce import API from pprint import pprint import requests import json wcapi = API( url="https://mysite.com/", consumer_key="ck_****************************************", consumer_secret="cs_************************************", wp_api=True, version="wc/v3", query_string_auth=True ) data = { # "name": "", # # "regular_price": "<new-regular-price>", # "description": "", # "short_description": "", "meta_data": [ {"key": "_math_rank_seo_focus_keyword", "value": "your keyword"}, {"key": "_math_rank_seo_title", "value": "your seo title"}, {"key": "_math_rank_seo_description", "value": "your seo description"}, ], # "slug": "new-product-url" # new url } response = wcapi.put("products/50244", data) pprint(response.json())
in the API response I found this:
. . . . . 'meta_data': [ {'id': 65182, 'key': '_math_rank_seo_focus_keyword', 'value': 'your keyword'}, {'id': 65183, 'key': '_math_rank_seo_description', 'value': 'your seo description'}, {'id': 65185, 'key': 'rank_math_seo_score', 'value': '19'}, {'id': 65186, 'key': '_rank_math_gtin_code', 'value': ''}, {'id': 65205, 'key': '_math_rank_seo_title', 'value': 'your seo title'}], . . . . .
but when I go to edit option in the product I could not see any any text on those field _math_rank_seo_focus_keyword, _math_rank_seo_title, _math_rank_seo_description
I see this ticket https://support.rankmath.com/ticket/how-to-setup-seo-title-using-wordpress-rest-api/
and I make the function to similar to this see the screenshot https://prnt.sc/12_CMLIxmkw7Now please tell me how can solve this issue.
The ticket ‘How to setup RankMath SEO focus keyword, meta description using rest api’ is closed to new replies.