Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Revert "Set inherit default to true only when is inserted in the arch…
Browse files Browse the repository at this point in the history
…ive product template (#8251)"

This reverts commit 39b0f91.
  • Loading branch information
albarin authored and nielslange committed Feb 1, 2023
1 parent c9ddc62 commit 4760884
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
7 changes: 1 addition & 6 deletions assets/js/blocks/product-query/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ const GLOBAL_HIDE_OUT_OF_STOCK = getSetting< boolean >(
false
);

const isArchiveProductTemplate = getSetting< boolean >(
'is_archive_product_template',
false
);

export const QUERY_DEFAULT_ATTRIBUTES: QueryBlockAttributes = {
allowedControls: DEFAULT_ALLOWED_CONTROLS,
displayLayout: {
Expand All @@ -69,7 +64,7 @@ export const QUERY_DEFAULT_ATTRIBUTES: QueryBlockAttributes = {
search: '',
exclude: [],
sticky: '',
inherit: isArchiveProductTemplate,
inherit: false,
__woocommerceAttributes: [],
__woocommerceStockStatus: GLOBAL_HIDE_OUT_OF_STOCK
? Object.keys( objectOmit( STOCK_STATUS_OPTIONS, 'outofstock' ) )
Expand Down
17 changes: 0 additions & 17 deletions src/BlockTypes/ProductQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,6 @@ public function update_query( $pre_render, $parsed_block ) {
}
}

/**
* Extra data passed through from server to client for block.
*
* @param array $attributes Any attributes that currently are available from the block.
* Note, this will be empty in the editor context when the block is
* not in the post content on editor load.
*/
protected function enqueue_data( array $attributes = [] ) {
parent::enqueue_data( $attributes );

global $pagenow;
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$post_id = isset( $_GET['postId'] ) ? sanitize_text_field( wp_unslash( $_GET['postId'] ) ) : null;
$is_archive_product_template = 'site-editor.php' === $pagenow && 'woocommerce/woocommerce//archive-product' === $post_id;
$this->asset_data_registry->add( 'is_archive_product_template', $is_archive_product_template, true );
}

/**
* Update the query for the product query block in Editor.
*
Expand Down

0 comments on commit 4760884

Please sign in to comment.