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

Revert "Set inherit setting to true when is inserted in the archive product template" #8352

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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