if (form.getFieldValue('category_id')) { const SaveCat = form.getFieldValue('category_id'); fetch(`http://localhost/wp/shopengine/wp-json/shopengine-builder/v1/settings/categories?ids=${SaveCat}`) .then(res => res.json()) .then(data => data.result) .then(result => { Object.entries(result).map(([key, value]) => { const myValue = { label: value, value: key, } if (myValue.value == SaveCat) { form.setFieldsValue({ category_id: myValue }); } }) }) }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter