Skip to content

Commit

Permalink
woocommerce product support (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
berryhijwegen authored May 29, 2023
1 parent 78a6b81 commit 1c89c6e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions wp-graphql-yoast-seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,18 @@ function get_post_type_graphql_fields($post, array $args, AppContext $context)
return get_post_type_graphql_fields($post, $args, $context);
},
]);

// if woocommerce is active, add seo to product
if (class_exists('WooCommerce')) {
register_graphql_field('Product', 'seo', [
'type' => 'PostTypeSEO',
'description' => __('The Yoast SEO data of the ContentNode', 'wp-graphql-yoast-seo'),
'resolve' => function ($post, array $args, AppContext $context) {
return get_post_type_graphql_fields($post, $args, $context);
},
]);
}

// TODO connect to content node
// Post Type SEO Data
if (!empty($post_types) && is_array($post_types)) {
Expand Down

0 comments on commit 1c89c6e

Please sign in to comment.