-
The products in my Woocommerce store are almost all books and the ISBN is stored as the SKU for each product. Is there a way to use the Sku value to populate the isbn meta for the product pages?
I thought I had solved this using the following filter, but it doesn’t seem to work once RankMath is installed:
add_filter( ‘woocommerce_structured_data_product’, ‘my_structured_data_product_filter’, 20, 2);
function my_structured_data_product_filter ( $markup, $product) {
$sku = $product->get_sku();
if (strlen ($sku) == 13 & strpos ($sku, “978”)===0) { // Only use sku as isbn if it has 13 chars starting 978
$markup[‘isbn’] = $sku; // Set isbn to product sku.
}
return $markup;
}Is there an equivalent filter I can use with RankMath?
The ticket ‘How to use Sku as ISBN meta’ is closed to new replies.