mirror of
https://github.com/wp-graphql/wp-graphql-woocommerce.git
synced 2026-08-14 12:53:44 +02:00
fix: Bug fixed in Product_Connection_Resolver::add_tax_query (#820)
* fix: Bug fixed in Product_Connection_Resolver::add_tax_query * fix: some product connection resolver hooks restored
This commit is contained in:
@@ -196,6 +196,7 @@ setup_plugin() {
|
||||
cd $WP_CORE_DIR
|
||||
|
||||
# Activate the plugin, it's dependencies should be activated already.
|
||||
wp plugin activate woocommerce wp-graphql
|
||||
wp plugin activate wp-graphql-woocommerce
|
||||
|
||||
# Flush the permalinks
|
||||
|
||||
@@ -72,7 +72,6 @@ modules:
|
||||
domain: '%WORDPRESS_DOMAIN%'
|
||||
adminEmail: '%ADMIN_EMAIL%'
|
||||
title: 'WooGraphQL Tests'
|
||||
theme: 'twentytwentyone'
|
||||
plugins:
|
||||
- woocommerce/woocommerce.php
|
||||
- woocommerce-gateway-stripe/woocommerce-gateway-stripe.php
|
||||
|
||||
Generated
+6
-6
@@ -8,16 +8,16 @@
|
||||
"packages": [
|
||||
{
|
||||
"name": "firebase/php-jwt",
|
||||
"version": "v6.9.0",
|
||||
"version": "v6.10.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/firebase/php-jwt.git",
|
||||
"reference": "f03270e63eaccf3019ef0f32849c497385774e11"
|
||||
"reference": "a49db6f0a5033aef5143295342f1c95521b075ff"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/f03270e63eaccf3019ef0f32849c497385774e11",
|
||||
"reference": "f03270e63eaccf3019ef0f32849c497385774e11",
|
||||
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff",
|
||||
"reference": "a49db6f0a5033aef5143295342f1c95521b075ff",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -65,9 +65,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/firebase/php-jwt/issues",
|
||||
"source": "https://github.com/firebase/php-jwt/tree/v6.9.0"
|
||||
"source": "https://github.com/firebase/php-jwt/tree/v6.10.0"
|
||||
},
|
||||
"time": "2023-10-05T00:24:42+00:00"
|
||||
"time": "2023-12-01T16:26:39+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
||||
@@ -252,16 +252,19 @@ class Product_Connection_Resolver extends AbstractConnectionResolver {
|
||||
* @return array
|
||||
*/
|
||||
public function ordering_meta() {
|
||||
return [
|
||||
'_price',
|
||||
'_regular_price',
|
||||
'_sale_price',
|
||||
'_wc_rating_count',
|
||||
'_wc_average_rating',
|
||||
'_sale_price_dates_from',
|
||||
'_sale_price_dates_to',
|
||||
'total_sales',
|
||||
];
|
||||
return apply_filters(
|
||||
'graphql_woocommerce_products_add_sort_fields',
|
||||
[
|
||||
'_price',
|
||||
'_regular_price',
|
||||
'_sale_price',
|
||||
'_wc_rating_count',
|
||||
'_wc_average_rating',
|
||||
'_sale_price_dates_from',
|
||||
'_sale_price_dates_to',
|
||||
'total_sales',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -660,7 +663,7 @@ class Product_Connection_Resolver extends AbstractConnectionResolver {
|
||||
* @return \WPGraphQL\WooCommerce\Data\Connection\Product_Connection_Resolver
|
||||
*/
|
||||
public function add_tax_query( $value ) {
|
||||
if ( ! empty( $this->query_args['tax_query'] ) ) {
|
||||
if ( empty( $this->query_args['tax_query'] ) ) {
|
||||
$this->query_args['tax_query'] = $value; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
|
||||
} else {
|
||||
$this->query_args['tax_query'][] = $value;
|
||||
|
||||
+17
-13
@@ -1,10 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\DataSynchronizer;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore;
|
||||
use Automattic\WooCommerce\Internal\Features\FeaturesController;
|
||||
|
||||
/**
|
||||
* Remove the "extensions" payload from GraphQL results
|
||||
* so that tests can make assertions without worrying about what's in the extensions payload
|
||||
@@ -23,10 +18,10 @@ add_filter(
|
||||
* Helper method to drop custom tables if present.
|
||||
*/
|
||||
function delete_order_custom_tables() {
|
||||
$features_controller = wc_get_container()->get( Featurescontroller::class );
|
||||
$features_controller = wc_get_container()->get( \Automattic\WooCommerce\Internal\Features\FeaturesController::class );
|
||||
$features_controller->change_feature_enable( 'custom_order_tables', true );
|
||||
$synchronizer = wc_get_container()
|
||||
->get( DataSynchronizer::class );
|
||||
->get( \Automattic\WooCommerce\Internal\DataStores\Orders\DataSynchronizer::class );
|
||||
if ( $synchronizer->check_orders_table_exists() ) {
|
||||
$synchronizer->delete_database_tables();
|
||||
}
|
||||
@@ -39,24 +34,33 @@ function delete_order_custom_tables() {
|
||||
* @return void
|
||||
*/
|
||||
function toggle_cot( bool $enabled ) {
|
||||
$features_controller = wc_get_container()->get( Featurescontroller::class );
|
||||
$features_controller = wc_get_container()->get( \Automattic\WooCommerce\Internal\Features\FeaturesController::class );
|
||||
$features_controller->change_feature_enable( 'custom_order_tables', $enabled );
|
||||
|
||||
update_option( CustomOrdersTableController::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION, wc_bool_to_string( $enabled ) );
|
||||
update_option(
|
||||
\Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION,
|
||||
wc_bool_to_string( $enabled )
|
||||
);
|
||||
|
||||
// Confirm things are really correct.
|
||||
$wc_data_store = WC_Data_Store::load( 'order' );
|
||||
assert( is_a( $wc_data_store->get_current_class_name(), OrdersTableDataStore::class, true ) === $enabled );
|
||||
assert(
|
||||
is_a(
|
||||
$wc_data_store->get_current_class_name(),
|
||||
\Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore::class,
|
||||
true
|
||||
) === $enabled
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to create custom tables if not present.
|
||||
*/
|
||||
function create_order_custom_table_if_not_exist() {
|
||||
$features_controller = wc_get_container()->get( Featurescontroller::class );
|
||||
$features_controller = wc_get_container()->get( \Automattic\WooCommerce\Internal\Features\FeaturesController::class );
|
||||
$features_controller->change_feature_enable( 'custom_order_tables', true );
|
||||
|
||||
$synchronizer = wc_get_container()->get( DataSynchronizer::class );
|
||||
$synchronizer = wc_get_container()->get( \Automattic\WooCommerce\Internal\DataStores\Orders\DataSynchronizer::class );
|
||||
if ( ! $synchronizer->check_orders_table_exists() ) {
|
||||
$synchronizer->create_database_tables();
|
||||
}
|
||||
@@ -75,5 +79,5 @@ function initialize_hpos() {
|
||||
|
||||
if ( defined( 'HPOS' ) ) {
|
||||
\codecept_debug( 'HPOS activated!!!' );
|
||||
initialize_hpos();
|
||||
//add_action( 'woocommerce_init', 'initialize_hpos' );
|
||||
}
|
||||
|
||||
@@ -209,13 +209,14 @@ class JWT
|
||||
string $keyId = null,
|
||||
array $head = null
|
||||
): string {
|
||||
$header = ['typ' => 'JWT', 'alg' => $alg];
|
||||
$header = ['typ' => 'JWT'];
|
||||
if (isset($head) && \is_array($head)) {
|
||||
$header = \array_merge($header, $head);
|
||||
}
|
||||
$header['alg'] = $alg;
|
||||
if ($keyId !== null) {
|
||||
$header['kid'] = $keyId;
|
||||
}
|
||||
if (isset($head) && \is_array($head)) {
|
||||
$header = \array_merge($head, $header);
|
||||
}
|
||||
$segments = [];
|
||||
$segments[] = static::urlsafeB64Encode((string) static::jsonEncode($header));
|
||||
$segments[] = static::urlsafeB64Encode((string) static::jsonEncode($payload));
|
||||
|
||||
Reference in New Issue
Block a user