Remove list/sale price from the General tab in grouped products (#42909)
* List and sale price should not be visible in the general tab for grouped products. * Add changelog files * Fix lint error
This commit is contained in:
parent
89fe33d64f
commit
1c3843e4ec
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Set passed props to the inner div in DisplayState component
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { createElement, Fragment } from '@wordpress/element';
|
||||
import { createElement } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -15,13 +15,18 @@ export type DisplayStateProps = {
|
|||
export const DisplayState: React.FC< DisplayStateProps > = ( {
|
||||
state = 'visible',
|
||||
children,
|
||||
...props
|
||||
} ) => {
|
||||
if ( state === 'visible' ) {
|
||||
return <>{ children }</>;
|
||||
return <div { ...props }>{ children }</div>;
|
||||
}
|
||||
|
||||
if ( state === 'visually-hidden' ) {
|
||||
return <div style={ { display: 'none' } }>{ children }</div>;
|
||||
return (
|
||||
<div { ...props } style={ { display: 'none' } }>
|
||||
{ children }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Use DisplayState as a direct wrapper of the woocommerce/conditional block
|
|
@ -57,12 +57,11 @@ export function Edit( {
|
|||
);
|
||||
|
||||
return (
|
||||
<div { ...blockProps }>
|
||||
<DisplayState
|
||||
state={ displayBlocks ? 'visible' : 'visually-hidden' }
|
||||
>
|
||||
<InnerBlocks templateLock="all" />
|
||||
</DisplayState>
|
||||
</div>
|
||||
<DisplayState
|
||||
{ ...blockProps }
|
||||
state={ displayBlocks ? 'visible' : 'visually-hidden' }
|
||||
>
|
||||
<InnerBlocks templateLock="all" />
|
||||
</DisplayState>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Remove list/sale price from the General tab in grouped products
|
|
@ -200,7 +200,23 @@ class SimpleProductTemplate extends AbstractProductFormTemplate implements Produ
|
|||
),
|
||||
)
|
||||
);
|
||||
$pricing_columns = $basic_details->add_block(
|
||||
|
||||
// This is needed until hide conditions can be applied to core blocks.
|
||||
$pricing_conditional_wrapper = $basic_details->add_block(
|
||||
array(
|
||||
'id' => 'product-pricing-conditional-wrapper',
|
||||
'blockName' => 'woocommerce/conditional',
|
||||
'order' => 30,
|
||||
'hideConditions' => array(
|
||||
array(
|
||||
'expression' => 'editedProduct.type === "grouped"',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$pricing_wrapper = Features::is_enabled( 'product-grouped' ) ? $pricing_conditional_wrapper : $basic_details;
|
||||
$pricing_columns = $pricing_wrapper->add_block(
|
||||
array(
|
||||
'id' => 'product-pricing-columns',
|
||||
'blockName' => 'core/columns',
|
||||
|
|
Loading…
Reference in New Issue