Add product variation flag to hide WIP (#36311)

* Add product variations feature flag

* Add changelog entry
This commit is contained in:
Joshua T Flowers 2023-01-05 18:30:23 -08:00 committed by GitHub
parent 45d157a25e
commit 04089f37e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 10 deletions

View File

@ -199,7 +199,9 @@ export const getPages = () => {
wpOpenMenu: 'menu-posts-product',
capability: 'manage_woocommerce',
} );
}
if ( window.wcAdminFeatures[ 'product-variation-management' ] ) {
pages.push( {
container: EditProductPage,
path: '/product/:productId/variation/:variationId',

View File

@ -130,12 +130,14 @@ const EditProductPage: React.FC = () => {
</div>
</ProductFormLayout>
) }
{ productVariation && product && (
<ProductVariationForm
product={ product }
productVariation={ productVariation }
/>
) }
{ window.wcAdminFeatures[ 'product-variation-management' ] &&
productVariation &&
product && (
<ProductVariationForm
product={ product }
productVariation={ productVariation }
/>
) }
{ ! isProductVariation &&
product &&
( product.status !== 'trash' || wasDeletedUsingAction ) && (

View File

@ -69,10 +69,14 @@ export const ProductForm: React.FC< {
>
<ProductShippingSection product={ product } />
</ProductFormTab>
<ProductFormTab name="options" title="Options">
<OptionsSection />
<ProductVariationsSection />
</ProductFormTab>
{ window.wcAdminFeatures[ 'product-variation-management' ] ? (
<ProductFormTab name="options" title="Options">
<OptionsSection />
<ProductVariationsSection />
</ProductFormTab>
) : (
<></>
) }
</ProductFormLayout>
<ProductFormFooter />
</Form>

View File

@ -4,6 +4,10 @@
import { Product } from '@woocommerce/data';
export const getDerivedProductType = ( product: Partial< Product > ) => {
if ( ! window.wcAdminFeatures[ 'product-variation-management' ] ) {
return 'simple';
}
const hasOptions = !! product.attributes?.find(
( attribute ) => attribute.options.length && attribute.variation
);

View File

@ -20,6 +20,7 @@ declare global {
onboarding: boolean;
'onboarding-tasks': boolean;
'payment-gateway-suggestions': boolean;
'product-variation-management': boolean;
'remote-inbox-notifications': boolean;
'remote-free-extensions': boolean;
settings: boolean;

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Add product variations flag to only show work in development

View File

@ -17,6 +17,7 @@
"new-product-management-experience": false,
"onboarding": true,
"onboarding-tasks": true,
"product-variation-management": false,
"remote-inbox-notifications": true,
"remote-free-extensions": true,
"payment-gateway-suggestions": true,

View File

@ -18,6 +18,7 @@
"onboarding": true,
"onboarding-tasks": true,
"payment-gateway-suggestions": true,
"product-variation-management": true,
"remote-inbox-notifications": true,
"remote-free-extensions": true,
"settings": false,