Home Page › Forums › Porto – AI Powered WordPress Website & Shop Builder › Missing Schema Fields
- This topic has 2 replies, 2 voices, and was last updated 1 year, 3 months ago by
Aizaz Awan.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
May 20, 2025 at 2:44 am #30431
Hi Aizaz, quick question for you, I’m getting some errors because these fields aren’t populating:
Missing field “hasMerchantReturnPolicy” (in “offers”)
Missing field “shippingDetails” (in “offers”)What’s the best way to get them to populate with data? I tried putting code into child theme functions.php but it didn’t work
[restrict userlevel="author"]get('Version')); } add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles'); function custom_add_to_cart_text() { return 'ADD TO CART NOW >'; } add_filter('woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_text'); /** * Add missing structured data fields for Google Merchant */ function add_missing_structured_data_fields($markup, $product) { if (!isset($markup['offers']) || !is_array($markup['offers'])) { return $markup; } // Loop through all offers and add the missing fields foreach ($markup['offers'] as $key => $offer) { // Add shippingDetails $markup['offers'][$key]['shippingDetails'] = [ '@type' => 'OfferShippingDetails', 'shippingRate' => [ '@type' => 'MonetaryAmount', 'value' => '0', 'currency' => 'CAD' ], 'deliveryTime' => [ '@type' => 'ShippingDeliveryTime', 'handlingTime' => [ '@type' => 'QuantitativeValue', 'minValue' => '1', 'maxValue' => '14', 'unitCode' => 'DAY' ], 'transitTime' => [ '@type' => 'QuantitativeValue', 'minValue' => '2', 'maxValue' => '10', 'unitCode' => 'DAY' ] ] ]; // Add hasMerchantReturnPolicy $markup['offers'][$key]['hasMerchantReturnPolicy'] = [ '@type' => 'MerchantReturnPolicy', 'returnPolicyCategory' => 'https://schema.org/MerchantReturnFiniteReturnWindow', 'merchantReturnDays' => 0, 'returnMethod' => 'https://schema.org/ReturnByMail', 'returnShippingFeesAmount' => [ '@type' => 'MonetaryAmount', 'value' => '0', 'currency' => 'CAD' ] ]; } return $markup; } // Hook into the WooCommerce product structured data add_filter('woocommerce_structured_data_product', 'add_missing_structured_data_fields', 10, 2); /** * Debug function to check the schema markup if needed * Uncomment to debug the structured data */ /* function debug_structured_data($markup) { if (current_user_can('administrator') && is_singular('product')) { echo ''; print_r($markup); echo ''; } return $markup; } add_filter('woocommerce_structured_data_product', 'debug_structured_data', 20, 1); */[/restrict]May 20, 2025 at 2:56 am #30432hm it maybe woocommerce issue now that I think about it.. not a porto related issue
May 20, 2025 at 1:26 pm #30471Hello, @chrishayes,
Yes you are right, this issue seems to be related to the WooCommerce plugin, please try to contact the WooCommerce support and ask for further assistance from them on this issue.
Best Regards,
PThemes Team. -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.