Files
wp-graphql-woocommerce/includes/functions.php
T
Geoffrey K TaylorandGitHub 9073793e86 chore: WPGraphQL v1.9.x connection resolver support added and autoloader removed. (#647)
* chore: WPGraphQL v1.9x + WP Bedrock support added.

* chore: lint compliance met.

* chore: composer/installers added back to allow-plugins
2022-08-26 14:53:36 -04:00

52 lines
995 B
PHP

<?php
/**
* Misc functions.
*
* @package WPGraphQL\WooCommerce
* @since 0.3.1
* @deprecated v0.10.2
*
* Will be removed in v0.11.0
*/
namespace WPGraphQL\WooCommerce\Functions;
/**
* Initializes minor integrations with other WordPress plugins.
*/
function setup_minor_integrations() {
add_filter(
'graphql_swp_result_possible_types',
'WPGraphQL\WooCommerce\Functions\woographql_swp_result_possible_types',
10,
1
);
}
/**
* QL Search integration - Adds to product types to the SWPResult possible types
*
* @param array $type_names SWPResults possible types.
* @return array
*/
function woographql_swp_result_possible_types( array $type_names ) {
if ( in_array( 'Product', $type_names, true ) ) {
$type_names = array_merge(
array_filter(
$type_names,
function( $type_name ) {
return 'Product' !== $type_name;
}
),
[
'SimpleProduct',
'VariableProduct',
'GroupProduct',
'ExternalProduct',
]
);
}
return $type_names;
}