mirror of
https://github.com/wp-graphql/wp-graphql-woocommerce.git
synced 2026-08-14 12:53:44 +02:00
* chore: setup PHPStan * chore: General code cleanup for PHPStan * chore: PHPStan to level 2 * chore: PHPStan to level 2 * fix: Syntax error fixed. * devops: PHPStan level 2 reached. * devops: PHPStan level 3 passed * devops: PHPStan level 4 passed * chore: fix bad typehints from jwt-auth [phpstan] * chore: simplify conditional logic in WC_Terms::register_connections() * chore: add stubs for WP type properties. * fix: check for valid WC_Order_Item before caching order. * chore: lint * devops: PHPStan level 6 passed. * chore: Linter compliance met. * chore: simplify logic and check for valid term. * fix: ensure valid types (partial) * chore: [phpcs] allow inline type annotations * devops: PHPStan level 8 reached. * devops: More stability fixes. * fix: general bugfixes and improvements * devops: Code Quality GA script added. * devops: Linter compliance met & 2 "phpstan-ignore" statements set. * devops: PHPStan config and CI script fixed. * fix: "cartItem" query resolution refactored * devops: GA scripts updated. * chore: Simple copy changes --------- Co-authored-by: Geoff Taylor <geoff@axistaylor.com>
55 lines
1017 B
PHP
55 lines
1017 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.
|
|
*
|
|
* @return void
|
|
*/
|
|
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;
|
|
}
|