Simplify Product Collection query attributes by removing attributes which are never used (https://github.com/woocommerce/woocommerce-blocks/pull/11259)
* Simply Product Collection query attribute by removing sticky and parents which are never used * Remove parents attribute from migration logic
This commit is contained in:
parent
9a1e26057c
commit
d548852380
|
@ -35,7 +35,6 @@ const mapAttributes = ( attributes ) => {
|
|||
woocommerceOnSale,
|
||||
woocommerceHandPickedProducts,
|
||||
taxQuery,
|
||||
parents,
|
||||
isProductCollectionBlock,
|
||||
...restQuery
|
||||
} = query;
|
||||
|
|
|
@ -49,7 +49,6 @@ const mapAttributes = ( attributes: Record< string, unknown > ) => {
|
|||
woocommerceOnSale: __woocommerceOnSale,
|
||||
woocommerceHandPickedProducts: include,
|
||||
taxQuery: {},
|
||||
parents: [],
|
||||
isProductCollectionBlock: true,
|
||||
...restQuery,
|
||||
},
|
||||
|
|
|
@ -43,10 +43,8 @@ export const DEFAULT_QUERY: ProductCollectionQuery = {
|
|||
author: '',
|
||||
search: '',
|
||||
exclude: [],
|
||||
sticky: '',
|
||||
inherit: null,
|
||||
taxQuery: {},
|
||||
parents: [],
|
||||
isProductCollectionBlock: true,
|
||||
woocommerceOnSale: false,
|
||||
woocommerceStockStatus: getDefaultStockStatuses(),
|
||||
|
|
|
@ -35,11 +35,9 @@ export interface ProductCollectionQuery {
|
|||
order: TProductCollectionOrder;
|
||||
orderBy: TProductCollectionOrderBy;
|
||||
pages: number;
|
||||
parents: number[];
|
||||
perPage: number;
|
||||
postType: string;
|
||||
search: string;
|
||||
sticky: string;
|
||||
taxQuery: Record< string, number[] >;
|
||||
woocommerceOnSale: boolean;
|
||||
/**
|
||||
|
|
|
@ -80,10 +80,8 @@ const ProductTemplateEdit = ( {
|
|||
author,
|
||||
search,
|
||||
exclude,
|
||||
sticky,
|
||||
inherit,
|
||||
taxQuery,
|
||||
parents,
|
||||
pages,
|
||||
...restQueryArgs
|
||||
},
|
||||
|
@ -165,15 +163,6 @@ const ProductTemplateEdit = ( {
|
|||
if ( exclude?.length ) {
|
||||
query.exclude = exclude;
|
||||
}
|
||||
if ( parents?.length ) {
|
||||
query.parent = parents;
|
||||
}
|
||||
// If sticky is not set, it will return all products in the results.
|
||||
// If sticky is set to `only`, it will limit the results to sticky products only.
|
||||
// If it is anything else, it will exclude sticky products from results. For the record the value stored is `exclude`.
|
||||
if ( sticky ) {
|
||||
query.sticky = sticky === 'only';
|
||||
}
|
||||
// If `inherit` is truthy, adjust conditionally the query to create a better preview.
|
||||
if ( inherit ) {
|
||||
if ( templateCategory ) {
|
||||
|
@ -200,11 +189,9 @@ const ProductTemplateEdit = ( {
|
|||
search,
|
||||
postType,
|
||||
exclude,
|
||||
sticky,
|
||||
inherit,
|
||||
templateSlug,
|
||||
taxQuery,
|
||||
parents,
|
||||
restQueryArgs,
|
||||
]
|
||||
);
|
||||
|
|
|
@ -234,7 +234,6 @@ final class CollectionFilters extends AbstractBlock {
|
|||
$mapped_params = array(
|
||||
'orderBy' => 'orderby',
|
||||
'pages' => 'page',
|
||||
'parents' => 'parent',
|
||||
'perPage' => 'per_page',
|
||||
'woocommerceStockStatus' => 'stock_status',
|
||||
'woocommerceOnSale' => 'on_sale',
|
||||
|
|
Loading…
Reference in New Issue