-
I’m using the RankMath free plugin to generate a product schema. My product data is created using ACF, and I noticed in GSC that some fields, like shippingDetails and hasMerchantReturnPolicy, are missing. I tried adding code to functions.php to include these fields in the RankMath schema, but it’s not working. Any suggestions?
add_filter(‘rank_math/json_ld’, function($data, $jsonld) {
if (!is_singular(‘your_custom_post_type’)) {
return $data;
} // replace ‘your_custom_post_type’ to ‘product’$data[‘offers’][0][‘priceValidUntil’] = ‘2024-12-31’;
$data[‘offers’][0][‘hasMerchantReturnPolicy’] = [
‘@type’ => ‘MerchantReturnPolicy’,
‘returnPolicyCategory’ => ‘https://schema.org/MerchantReturnFiniteReturnWindow’,
‘returnFees’ => ‘https://schema.org/FreeReturn’
];
return $data;
}, 10, 2);
You must be logged in to reply to this ticket.