diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout-shared/use-forced-layout.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout-shared/use-forced-layout.ts
index 39deab87852..bece364977e 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout-shared/use-forced-layout.ts
+++ b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout-shared/use-forced-layout.ts
@@ -42,16 +42,14 @@ export const useForcedLayout = ( {
const currentRegisteredBlocks = useRef( registeredBlocks );
const currentDefaultTemplate = useRef( defaultTemplate );
- const { insertBlock, replaceInnerBlocks } = useDispatch(
- 'core/block-editor'
- );
+ const { insertBlock, replaceInnerBlocks } =
+ useDispatch( 'core/block-editor' );
const { innerBlocks, registeredBlockTypes } = useSelect(
( select ) => {
return {
- innerBlocks: select( 'core/block-editor' ).getBlocks(
- clientId
- ),
+ innerBlocks:
+ select( 'core/block-editor' ).getBlocks( clientId ),
registeredBlockTypes: currentRegisteredBlocks.current.map(
( blockName ) => getBlockType( blockName )
),
@@ -110,9 +108,10 @@ export const useForcedLayout = ( {
}
// Is the forced block part of the default template, find it's original position.
- const defaultTemplatePosition = currentDefaultTemplate.current.findIndex(
- ( [ blockName ] ) => blockName === block.name
- );
+ const defaultTemplatePosition =
+ currentDefaultTemplate.current.findIndex(
+ ( [ blockName ] ) => blockName === block.name
+ );
switch ( defaultTemplatePosition ) {
case -1:
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout-shared/use-view-switcher.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout-shared/use-view-switcher.tsx
index 8d1fdc63c2c..ead1af9d067 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout-shared/use-view-switcher.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout-shared/use-view-switcher.tsx
@@ -29,11 +29,8 @@ export const useViewSwitcher = (
const initialView = views[ 0 ];
const [ currentView, setCurrentView ] = useState( initialView );
const { selectBlock } = useDispatch( 'core/block-editor' );
- const {
- getBlock,
- getSelectedBlockClientId,
- getBlockParentsByBlockName,
- } = select( blockEditorStore );
+ const { getBlock, getSelectedBlockClientId, getBlockParentsByBlockName } =
+ select( blockEditorStore );
const selectedBlockClientId = getSelectedBlockClientId();
useEffect( () => {
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/cart-line-items-table/cart-line-item-row.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/cart-line-items-table/cart-line-item-row.tsx
index 999d299d9f0..af32e5f9551 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/cart/cart-line-items-table/cart-line-item-row.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/cart-line-items-table/cart-line-item-row.tsx
@@ -114,12 +114,8 @@ const CartLineItemRow = forwardRef< HTMLTableRowElement, CartLineItemRowProps >(
extensions,
} = lineItem;
- const {
- quantity,
- setItemQuantity,
- removeItem,
- isPendingDelete,
- } = useStoreCartItemQuantity( lineItem );
+ const { quantity, setItemQuantity, removeItem, isPendingDelete } =
+ useStoreCartItemQuantity( lineItem );
const { dispatchStoreEvent } = useStoreEvents();
// Prepare props to pass to the __experimentalApplyCheckoutFilter filter.
@@ -150,9 +146,8 @@ const CartLineItemRow = forwardRef< HTMLTableRowElement, CartLineItemRowProps >(
amount: parseInt( prices.raw_prices.price, 10 ),
precision: prices.raw_prices.precision,
} );
- const saleAmountSingle = regularAmountSingle.subtract(
- purchaseAmountSingle
- );
+ const saleAmountSingle =
+ regularAmountSingle.subtract( purchaseAmountSingle );
const saleAmount = saleAmountSingle.multiply( quantity );
const totalsCurrency = getCurrencyFromPriceResponse( totals );
let lineSubtotal = parseInt( totals.line_subtotal, 10 );
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/edit.tsx
index 1bfbfff15f4..8d7fc22c17c 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/edit.tsx
@@ -56,7 +56,8 @@ export const Edit = ( {
const hasExpressPaymentMethods = Object.keys( paymentMethods ).length > 0;
const blockProps = useBlockProps( {
className: classnames( {
- 'wp-block-woocommerce-cart-express-payment-block--has-express-payment-methods': hasExpressPaymentMethods,
+ 'wp-block-woocommerce-cart-express-payment-block--has-express-payment-methods':
+ hasExpressPaymentMethods,
} ),
} );
const { className } = attributes;
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/edit.tsx
index c541b07611b..ccaaf05677f 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/edit.tsx
@@ -52,7 +52,8 @@ export const Edit = ( {
checked={ isShippingCalculatorEnabled }
onChange={ () =>
setAttributes( {
- isShippingCalculatorEnabled: ! isShippingCalculatorEnabled,
+ isShippingCalculatorEnabled:
+ ! isShippingCalculatorEnabled,
} )
}
/>
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/edit.tsx
index d7b925202c9..9d3c3df688a 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/edit.tsx
@@ -56,7 +56,8 @@ export const Edit = ( {
checked={ showRateAfterTaxName }
onChange={ () =>
setAttributes( {
- showRateAfterTaxName: ! showRateAfterTaxName,
+ showRateAfterTaxName:
+ ! showRateAfterTaxName,
} )
}
/>
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/edit.tsx
index 73995b42f9c..7b7a909b23c 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/edit.tsx
@@ -36,7 +36,7 @@ const browseStoreTemplate = SHOP_URL
]
: null;
-const defaultTemplate = ( [
+const defaultTemplate = [
[
'core/image',
{
@@ -79,7 +79,7 @@ const defaultTemplate = ( [
rows: 1,
},
],
-].filter( Boolean ) as unknown ) as TemplateArray;
+].filter( Boolean ) as unknown as TemplateArray;
export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {
const blockProps = useBlockProps();
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/block.tsx
index 49875f5804d..c2aea4d84bb 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/block.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/proceed-to-checkout-block/block.tsx
@@ -27,10 +27,8 @@ const Block = ( {
} ): JSX.Element => {
const link = getSetting( 'page-' + checkoutPageId, false );
const { isCalculating } = useCheckoutContext();
- const [
- positionReferenceElement,
- positionRelativeToViewport,
- ] = usePositionRelativeToViewport();
+ const [ positionReferenceElement, positionRelativeToViewport ] =
+ usePositionRelativeToViewport();
const [ showSpinner, setShowSpinner ] = useState( false );
useEffect( () => {
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/register-components.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/register-components.ts
index 6db34a47bba..bf4ac082f28 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/register-components.ts
+++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/register-components.ts
@@ -16,170 +16,187 @@ __webpack_public_path__ = WC_BLOCKS_BUILD_URL;
registerCheckoutBlock( {
metadata: metadata.FILLED_CART,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/filled-cart" */
- './filled-cart-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/filled-cart" */
+ './filled-cart-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.EMPTY_CART,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/empty-cart" */
- './empty-cart-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/empty-cart" */
+ './empty-cart-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ITEMS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/cart-items" */
- './cart-items-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/cart-items" */
+ './cart-items-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_LINE_ITEMS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/cart-line-items" */
- './cart-line-items-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/cart-line-items" */
+ './cart-line-items-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_TOTALS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/cart-totals" */
- './cart-totals-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/cart-totals" */
+ './cart-totals-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_EXPRESS_PAYMENT,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/cart-express-payment" */
- './cart-express-payment-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/cart-express-payment" */
+ './cart-express-payment-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.PROCEED_TO_CHECKOUT,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/proceed-to-checkout" */
- './proceed-to-checkout-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/proceed-to-checkout" */
+ './proceed-to-checkout-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ACCEPTED_PAYMENT_METHODS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/cart-accepted-payment-methods" */
- './cart-accepted-payment-methods-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/cart-accepted-payment-methods" */
+ './cart-accepted-payment-methods-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ORDER_SUMMARY,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/cart-order-summary" */
- './cart-order-summary-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/cart-order-summary" */
+ './cart-order-summary-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ORDER_SUMMARY_HEADING,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/order-summary-heading" */
- './cart-order-summary-heading/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/order-summary-heading" */
+ './cart-order-summary-heading/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ORDER_SUMMARY_SUBTOTAL,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/order-summary-subtotal" */
- './cart-order-summary-subtotal/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/order-summary-subtotal" */
+ './cart-order-summary-subtotal/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ORDER_SUMMARY_FEE,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/order-summary-fee" */
- './cart-order-summary-fee/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/order-summary-fee" */
+ './cart-order-summary-fee/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ORDER_SUMMARY_DISCOUNT,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/order-summary-discount" */
- './cart-order-summary-discount/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/order-summary-discount" */
+ './cart-order-summary-discount/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ORDER_SUMMARY_COUPON_FORM,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/order-summary-coupon-form" */
- './cart-order-summary-coupon-form/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/order-summary-coupon-form" */
+ './cart-order-summary-coupon-form/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ORDER_SUMMARY_SHIPPING,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/order-summary-shipping" */
- './cart-order-summary-shipping/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/order-summary-shipping" */
+ './cart-order-summary-shipping/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ORDER_SUMMARY_TAXES,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/order-summary-taxes" */
- './cart-order-summary-taxes/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/order-summary-taxes" */
+ './cart-order-summary-taxes/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CART_ORDER_SUMMARY_HEADING,
- component: lazy( () =>
- import(
- /* webpackChunkName: "cart-blocks/order-summary-heading" */
- './cart-order-summary-heading/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "cart-blocks/order-summary-heading" */
+ './cart-order-summary-heading/frontend'
+ )
),
} );
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/block.tsx
index 3c5112d8da4..17204ba34c0 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/block.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/block.tsx
@@ -104,14 +104,10 @@ const ScrollOnError = ( {
}: {
scrollToTop: ( props: Record< string, unknown > ) => void;
} ): null => {
- const {
- hasError: checkoutHasError,
- isIdle: checkoutIsIdle,
- } = useCheckoutContext();
- const {
- hasValidationErrors,
- showAllValidationErrors,
- } = useValidationContext();
+ const { hasError: checkoutHasError, isIdle: checkoutIsIdle } =
+ useCheckoutContext();
+ const { hasValidationErrors, showAllValidationErrors } =
+ useValidationContext();
const hasErrorsToDisplay =
checkoutIsIdle &&
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/context.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/context.ts
index 6e5be401cc0..7293a909e3a 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/context.ts
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/context.ts
@@ -41,17 +41,17 @@ export const CheckoutBlockContext = createContext< CheckoutBlockContextProps >(
}
);
-export const CheckoutBlockControlsContext = createContext<
- CheckoutBlockControlsContextProps
->( {
- addressFieldControls: () => null,
- accountControls: () => null,
-} );
+export const CheckoutBlockControlsContext =
+ createContext< CheckoutBlockControlsContextProps >( {
+ addressFieldControls: () => null,
+ accountControls: () => null,
+ } );
export const useCheckoutBlockContext = (): CheckoutBlockContextProps => {
return useContext( CheckoutBlockContext );
};
-export const useCheckoutBlockControlsContext = (): CheckoutBlockControlsContextProps => {
- return useContext( CheckoutBlockControlsContext );
-};
+export const useCheckoutBlockControlsContext =
+ (): CheckoutBlockControlsContextProps => {
+ return useContext( CheckoutBlockControlsContext );
+ };
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/form-step-block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/form-step-block.tsx
index 240df907b63..d4eaee87de3 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/form-step-block.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/form-step-block.tsx
@@ -34,7 +34,8 @@ export const FormStepBlock = ( {
const { title = '', description = '', showStepNumber = true } = attributes;
const blockProps = useBlockProps( {
className: classnames( 'wc-block-components-checkout-step', className, {
- 'wc-block-components-checkout-step--with-step-number': showStepNumber,
+ 'wc-block-components-checkout-step--with-step-number':
+ showStepNumber,
} ),
} );
return (
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/edit.tsx
index 0a19dac5d6a..692b9c4f20c 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/edit.tsx
@@ -39,9 +39,8 @@ export const Edit = ( {
showPhoneField,
requirePhoneField,
} = useCheckoutBlockContext();
- const {
- addressFieldControls: Controls,
- } = useCheckoutBlockControlsContext();
+ const { addressFieldControls: Controls } =
+ useCheckoutBlockControlsContext();
const { showBillingFields } = useCheckoutAddress();
if ( ! showBillingFields ) {
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-contact-information-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-contact-information-block/block.tsx
index 7621be71f49..9c1d5b3e27e 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-contact-information-block/block.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-contact-information-block/block.tsx
@@ -20,11 +20,8 @@ const Block = ( {
}: {
allowCreateAccount: boolean;
} ): JSX.Element => {
- const {
- customerId,
- shouldCreateAccount,
- setShouldCreateAccount,
- } = useCheckoutContext();
+ const { customerId, shouldCreateAccount, setShouldCreateAccount } =
+ useCheckoutContext();
const { billingAddress, setEmail } = useCheckoutAddress();
const { dispatchCheckoutEvent } = useStoreEvents();
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/edit.tsx
index 94c65db9dcb..e93ad860a0b 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/edit.tsx
@@ -63,7 +63,8 @@ export const Edit = ( {
const blockProps = useBlockProps( {
className: classnames(
{
- 'wp-block-woocommerce-checkout-express-payment-block--has-express-payment-methods': hasExpressPaymentMethods,
+ 'wp-block-woocommerce-checkout-express-payment-block--has-express-payment-methods':
+ hasExpressPaymentMethods,
},
attributes?.className
),
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx
index 01072c5fb22..c5fb4f5aa40 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx
@@ -34,11 +34,10 @@ export const Edit = ( {
} );
const allowedBlocks = getAllowedBlocks( innerBlockAreas.CHECKOUT_FIELDS );
- const {
- addressFieldControls: Controls,
- } = useCheckoutBlockControlsContext();
+ const { addressFieldControls: Controls } =
+ useCheckoutBlockControlsContext();
- const defaultTemplate = ( [
+ const defaultTemplate = [
[ 'woocommerce/checkout-express-payment-block', {}, [] ],
[ 'woocommerce/checkout-contact-information-block', {}, [] ],
[ 'woocommerce/checkout-shipping-address-block', {}, [] ],
@@ -48,7 +47,7 @@ export const Edit = ( {
[ 'woocommerce/checkout-order-note-block', {}, [] ],
[ 'woocommerce/checkout-terms-block', {}, [] ],
[ 'woocommerce/checkout-actions-block', {}, [] ],
- ].filter( Boolean ) as unknown ) as TemplateArray;
+ ].filter( Boolean ) as unknown as TemplateArray;
useForcedLayout( {
clientId,
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/test/block.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/test/block.js
index aced808a6d9..cd2de576659 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/test/block.js
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/test/block.js
@@ -103,8 +103,7 @@ jest.mock( '@woocommerce/base-context/hooks', () => ( {
meta_data: [
{
key: 'Items',
- value:
- 'Hoodie - Blue, Yes × 1, Beanie × 1',
+ value: 'Hoodie - Blue, Yes × 1, Beanie × 1',
},
],
selected: false,
@@ -128,8 +127,7 @@ jest.mock( '@woocommerce/base-context/hooks', () => ( {
meta_data: [
{
key: 'Items',
- value:
- 'Hoodie - Blue, Yes × 1, Beanie × 1',
+ value: 'Hoodie - Blue, Yes × 1, Beanie × 1',
},
],
selected: false,
@@ -153,8 +151,7 @@ jest.mock( '@woocommerce/base-context/hooks', () => ( {
meta_data: [
{
key: 'Items',
- value:
- 'Hoodie - Blue, Yes × 1, Beanie × 1',
+ value: 'Hoodie - Blue, Yes × 1, Beanie × 1',
},
],
selected: true,
@@ -476,8 +473,7 @@ describe( 'Checkout Order Summary', () => {
meta_data: [
{
key: 'Items',
- value:
- 'Hoodie - Blue, Yes × 1, Beanie × 1',
+ value: 'Hoodie - Blue, Yes × 1, Beanie × 1',
},
],
selected: true,
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/block.tsx
index 30a8ae4353c..03e34d428be 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/block.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/block.tsx
@@ -13,9 +13,8 @@ const Block = ( {
} ): JSX.Element | null => {
const couponsEnabled = getSetting( 'couponsEnabled', true );
- const { applyCoupon, isApplyingCoupon } = useStoreCartCoupons(
- 'wc/checkout'
- );
+ const { applyCoupon, isApplyingCoupon } =
+ useStoreCartCoupons( 'wc/checkout' );
if ( ! couponsEnabled ) {
return null;
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.tsx
index cf9fd4d6df9..4068d6a5719 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.tsx
@@ -27,9 +27,8 @@ const DiscountSlotFill = (): JSX.Element => {
const Block = ( { className = '' }: { className?: string } ): JSX.Element => {
const { cartTotals, cartCoupons } = useStoreCart();
- const { removeCoupon, isRemovingCoupon } = useStoreCartCoupons(
- 'wc/checkout'
- );
+ const { removeCoupon, isRemovingCoupon } =
+ useStoreCartCoupons( 'wc/checkout' );
const totalsCurrency = getCurrencyFromPriceResponse( cartTotals );
return (
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/edit.tsx
index d7b925202c9..9d3c3df688a 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/edit.tsx
@@ -56,7 +56,8 @@ export const Edit = ( {
checked={ showRateAfterTaxName }
onChange={ () =>
setAttributes( {
- showRateAfterTaxName: ! showRateAfterTaxName,
+ showRateAfterTaxName:
+ ! showRateAfterTaxName,
} )
}
/>
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/edit.tsx
index b10d8e02868..645f5541623 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/edit.tsx
@@ -38,9 +38,8 @@ export const Edit = ( {
showPhoneField,
requirePhoneField,
} = useCheckoutBlockContext();
- const {
- addressFieldControls: Controls,
- } = useCheckoutBlockControlsContext();
+ const { addressFieldControls: Controls } =
+ useCheckoutBlockControlsContext();
return (
{
return null;
}
- const shippingRatesPackageCount = getShippingRatesPackageCount(
- shippingRates
- );
+ const shippingRatesPackageCount =
+ getShippingRatesPackageCount( shippingRates );
if (
! isEditor &&
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/frontend.tsx
index 098f68dc5ee..cef8fc5ec20 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/frontend.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/frontend.tsx
@@ -32,11 +32,8 @@ const FrontendBlock = ( {
const { isDisabled } = useCheckoutSubmit();
const validationErrorId = 'terms-and-conditions-' + instanceId;
- const {
- getValidationError,
- setValidationErrors,
- clearValidationError,
- } = validation;
+ const { getValidationError, setValidationErrors, clearValidationError } =
+ validation;
const error = getValidationError( validationErrorId ) || {};
const hasError = error.message && ! error.hidden;
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js
index f46b8340848..1523f7003cb 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js
@@ -91,8 +91,7 @@ describe( 'Edit', () => {
const { container } = render(
terms and privacy ',
+ text: 'I agree to the terms and privacy ',
checkbox: true,
} }
setAttributes={ () => void 0 }
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts
index a6837e41ee0..0c4fd7b7888 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts
+++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts
@@ -17,178 +17,197 @@ __webpack_public_path__ = WC_BLOCKS_BUILD_URL;
// @todo When forcing all blocks at once, they will append based on the order they are registered. Introduce formal sorting param.
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_FIELDS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/fields" */ './checkout-fields-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/fields" */ './checkout-fields-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_EXPRESS_PAYMENT,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/express-payment" */ './checkout-express-payment-block/block'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/express-payment" */ './checkout-express-payment-block/block'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_CONTACT_INFORMATION,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/contact-information" */ './checkout-contact-information-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/contact-information" */ './checkout-contact-information-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_SHIPPING_ADDRESS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/shipping-address" */ './checkout-shipping-address-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/shipping-address" */ './checkout-shipping-address-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_BILLING_ADDRESS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/billing-address" */ './checkout-billing-address-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/billing-address" */ './checkout-billing-address-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_SHIPPING_METHODS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/shipping-methods" */ './checkout-shipping-methods-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/shipping-methods" */ './checkout-shipping-methods-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_PAYMENT,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/payment" */ './checkout-payment-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/payment" */ './checkout-payment-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ORDER_NOTE,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/order-note" */ './checkout-order-note-block/block'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/order-note" */ './checkout-order-note-block/block'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_TERMS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/terms" */ './checkout-terms-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/terms" */ './checkout-terms-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ACTIONS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/actions" */ './checkout-actions-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/actions" */ './checkout-actions-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_TOTALS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/totals" */ './checkout-totals-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/totals" */ './checkout-totals-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ORDER_SUMMARY,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/order-summary" */ './checkout-order-summary-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/order-summary" */ './checkout-order-summary-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ORDER_SUMMARY_CART_ITEMS,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/order-summary-cart-items" */
- './checkout-order-summary-cart-items/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/order-summary-cart-items" */
+ './checkout-order-summary-cart-items/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ORDER_SUMMARY_SUBTOTAL,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/order-summary-subtotal" */
- './checkout-order-summary-subtotal/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/order-summary-subtotal" */
+ './checkout-order-summary-subtotal/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ORDER_SUMMARY_FEE,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/order-summary-fee" */
- './checkout-order-summary-fee/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/order-summary-fee" */
+ './checkout-order-summary-fee/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ORDER_SUMMARY_DISCOUNT,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/order-summary-discount" */
- './checkout-order-summary-discount/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/order-summary-discount" */
+ './checkout-order-summary-discount/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ORDER_SUMMARY_COUPON_FORM,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/order-summary-coupon-form" */
- './checkout-order-summary-coupon-form/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/order-summary-coupon-form" */
+ './checkout-order-summary-coupon-form/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ORDER_SUMMARY_SHIPPING,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/order-summary-shipping" */
- './checkout-order-summary-shipping/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/order-summary-shipping" */
+ './checkout-order-summary-shipping/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: metadata.CHECKOUT_ORDER_SUMMARY_TAXES,
- component: lazy( () =>
- import(
- /* webpackChunkName: "checkout-blocks/order-summary-taxes" */
- './checkout-order-summary-taxes/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "checkout-blocks/order-summary-taxes" */
+ './checkout-order-summary-taxes/frontend'
+ )
),
} );
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/block-controls.tsx b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/block-controls.tsx
index 789490665f4..79d3754e4b3 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/block-controls.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/block-controls.tsx
@@ -136,39 +136,37 @@ export const BlockControls = ( {
);
};
-export const withBlockControls = ( {
- cropLabel,
- editLabel,
-}: BlockControlsConfiguration ) => < T extends EditorBlock< T > >(
- Component: ComponentType< T >
-) => ( props: WithBlockControlsProps< T > ) => {
- const [ isEditingImage, setIsEditingImage ] = props.useEditingImage;
- const { attributes, category, name, product, setAttributes } = props;
- const { contentAlign, editMode, mediaId, mediaSrc } = attributes;
- const item = category || product;
+export const withBlockControls =
+ ( { cropLabel, editLabel }: BlockControlsConfiguration ) =>
+ < T extends EditorBlock< T > >( Component: ComponentType< T > ) =>
+ ( props: WithBlockControlsProps< T > ) => {
+ const [ isEditingImage, setIsEditingImage ] = props.useEditingImage;
+ const { attributes, category, name, product, setAttributes } = props;
+ const { contentAlign, editMode, mediaId, mediaSrc } = attributes;
+ const item = category || product;
- const { backgroundImageId, backgroundImageSrc } = useBackgroundImage( {
- item,
- mediaId,
- mediaSrc,
- blockName: name,
- } );
+ const { backgroundImageId, backgroundImageSrc } = useBackgroundImage( {
+ item,
+ mediaId,
+ mediaSrc,
+ blockName: name,
+ } );
- return (
- <>
-
-
- >
- );
-};
+ return (
+ <>
+
+
+ >
+ );
+ };
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/image-editor.tsx b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/image-editor.tsx
index bd426d52e75..843ba04d582 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/image-editor.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/image-editor.tsx
@@ -92,35 +92,37 @@ export const ImageEditor = ( {
);
};
-export const withImageEditor = < T extends EditorBlock< T > >(
- Component: ComponentType< T >
-) => ( props: WithImageEditorProps< T > ) => {
- const [ isEditingImage, setIsEditingImage ] = props.useEditingImage;
+export const withImageEditor =
+ < T extends EditorBlock< T > >( Component: ComponentType< T > ) =>
+ ( props: WithImageEditorProps< T > ) => {
+ const [ isEditingImage, setIsEditingImage ] = props.useEditingImage;
- const { attributes, backgroundImageSize, name, setAttributes } = props;
- const { mediaId, mediaSrc } = attributes;
- const item =
- name === BLOCK_NAMES.featuredProduct ? props.product : props.category;
+ const { attributes, backgroundImageSize, name, setAttributes } = props;
+ const { mediaId, mediaSrc } = attributes;
+ const item =
+ name === BLOCK_NAMES.featuredProduct
+ ? props.product
+ : props.category;
- const { backgroundImageId, backgroundImageSrc } = useBackgroundImage( {
- item,
- mediaId,
- mediaSrc,
- blockName: name,
- } );
+ const { backgroundImageId, backgroundImageSrc } = useBackgroundImage( {
+ item,
+ mediaId,
+ mediaSrc,
+ blockName: name,
+ } );
- if ( isEditingImage ) {
- return (
-
- );
- }
+ if ( isEditingImage ) {
+ return (
+
+ );
+ }
- return ;
-};
+ return ;
+ };
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/inspector-controls.tsx b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/inspector-controls.tsx
index ab81c80df73..0daaaf72c0f 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/inspector-controls.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/inspector-controls.tsx
@@ -287,70 +287,72 @@ export const InspectorControls = ( {
);
};
-export const withInspectorControls = < T extends EditorBlock< T > >(
- Component: ComponentType< T >
-) => ( props: WithInspectorControlsProps< T > ) => {
- const { attributes, name, setAttributes } = props;
- const {
- alt,
- dimRatio,
- focalPoint,
- hasParallax,
- isRepeated,
- imageFit,
- mediaId,
- mediaSrc,
- overlayColor,
- overlayGradient,
- showDesc,
- showPrice,
- } = attributes;
+export const withInspectorControls =
+ < T extends EditorBlock< T > >( Component: ComponentType< T > ) =>
+ ( props: WithInspectorControlsProps< T > ) => {
+ const { attributes, name, setAttributes } = props;
+ const {
+ alt,
+ dimRatio,
+ focalPoint,
+ hasParallax,
+ isRepeated,
+ imageFit,
+ mediaId,
+ mediaSrc,
+ overlayColor,
+ overlayGradient,
+ showDesc,
+ showPrice,
+ } = attributes;
- const item =
- name === BLOCK_NAMES.featuredProduct ? props.product : props.category;
+ const item =
+ name === BLOCK_NAMES.featuredProduct
+ ? props.product
+ : props.category;
- const { setGradient } = useGradient( {
- gradientAttribute: 'overlayGradient',
- customGradientAttribute: 'overlayGradient',
- } );
- const { backgroundImageSrc } = useBackgroundImage( {
- item,
- mediaId,
- mediaSrc,
- blockName: name,
- } );
+ const { setGradient } = useGradient( {
+ gradientAttribute: 'overlayGradient',
+ customGradientAttribute: 'overlayGradient',
+ } );
+ const { backgroundImageSrc } = useBackgroundImage( {
+ item,
+ mediaId,
+ mediaSrc,
+ blockName: name,
+ } );
- const contentPanel =
- name === BLOCK_NAMES.featuredProduct ? (
-
- setAttributes( {
- showPrice: ! showPrice,
- } )
- }
- />
- ) : undefined;
+ const contentPanel =
+ name === BLOCK_NAMES.featuredProduct ? (
+
+ setAttributes( {
+ showPrice: ! showPrice,
+ } )
+ }
+ />
+ ) : undefined;
- return (
- <>
-
-
- >
- );
-};
+ return (
+ <>
+
+
+ >
+ );
+ };
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/utils.ts b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/utils.ts
index 140053be7f2..d4a7d9162d4 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/utils.ts
+++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/utils.ts
@@ -61,9 +61,8 @@ export function getBackgroundImageStyles( {
...( url && {
backgroundImage: `url(${ url })`,
} ),
- backgroundPosition: calculatePercentPositionFromCoordinates(
- focalPoint
- ),
+ backgroundPosition:
+ calculatePercentPositionFromCoordinates( focalPoint ),
...( ! isRepeated && {
backgroundRepeat: 'no-repeat',
backgroundSize: imageFit === 'cover' ? imageFit : 'auto',
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-api-error.tsx b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-api-error.tsx
index 36bd29c4df9..a49ce87ec97 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-api-error.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-api-error.tsx
@@ -33,27 +33,27 @@ type APIErrorProps< T extends Block > =
| ( T & APIErrorProductProps )
| ( T & APIErrorCategoryProps );
-export const withApiError = < T extends Block >(
- Component: ComponentType< T >
-) => ( props: APIErrorProps< T > ) => {
- const { error, isLoading, name } = props;
+export const withApiError =
+ < T extends Block >( Component: ComponentType< T > ) =>
+ ( props: APIErrorProps< T > ) => {
+ const { error, isLoading, name } = props;
- const className = getClassPrefixFromName( name );
- const onRetry =
- name === BLOCK_NAMES.featuredCategory
- ? props.getCategory
- : props.getProduct;
+ const className = getClassPrefixFromName( name );
+ const onRetry =
+ name === BLOCK_NAMES.featuredCategory
+ ? props.getCategory
+ : props.getProduct;
- if ( error ) {
- return (
-
- );
- }
+ if ( error ) {
+ return (
+
+ );
+ }
- return ;
-};
+ return ;
+ };
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-edit-mode.tsx b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-edit-mode.tsx
index 02db002e9dc..7e4e91fdf1e 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-edit-mode.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-edit-mode.tsx
@@ -40,94 +40,90 @@ interface EditModeRequiredProps< T > {
type EditModeProps< T extends EditorBlock< T > > = T &
EditModeRequiredProps< T >;
-export const withEditMode = ( {
- description,
- editLabel,
- icon,
- label,
-}: EditModeConfiguration ) => < T extends EditorBlock< T > >(
- Component: ComponentType< T >
-) => ( props: EditModeProps< T > ) => {
- const {
- attributes,
- debouncedSpeak,
- name,
- setAttributes,
- triggerUrlUpdate = () => void null,
- } = props;
+export const withEditMode =
+ ( { description, editLabel, icon, label }: EditModeConfiguration ) =>
+ < T extends EditorBlock< T > >( Component: ComponentType< T > ) =>
+ ( props: EditModeProps< T > ) => {
+ const {
+ attributes,
+ debouncedSpeak,
+ name,
+ setAttributes,
+ triggerUrlUpdate = () => void null,
+ } = props;
- const className = getClassPrefixFromName( name );
+ const className = getClassPrefixFromName( name );
- const onDone = () => {
- setAttributes( { editMode: false } );
- debouncedSpeak( editLabel );
- };
+ const onDone = () => {
+ setAttributes( { editMode: false } );
+ debouncedSpeak( editLabel );
+ };
- if ( attributes.editMode ) {
- return (
- }
- label={ label }
- className={ className }
- >
- { description }
-
- { name === BLOCK_NAMES.featuredCategory && (
- // Ignoring this TS error for now as it seems that `ProductCategoryControl`
- // types might be too strict.
- // @todo Convert `ProductCategoryControl` to TypeScript
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore
-
{
- const id = value[ 0 ] ? value[ 0 ].id : 0;
- setAttributes( {
- categoryId: id,
- mediaId: 0,
- mediaSrc: '',
- } );
- triggerUrlUpdate();
- } }
- isSingle
- />
- ) }
- { name === BLOCK_NAMES.featuredProduct && (
- }
+ label={ label }
+ className={ className }
+ >
+ { description }
+
+ { name === BLOCK_NAMES.featuredCategory && (
+ // Ignoring this TS error for now as it seems that `ProductCategoryControl`
+ // types might be too strict.
+ // @todo Convert `ProductCategoryControl` to TypeScript
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
- showVariations
- onChange={ (
- value: ProductResponseItem[] = []
- ) => {
- const id = value[ 0 ] ? value[ 0 ].id : 0;
- setAttributes( {
- productId: id,
- mediaId: 0,
- mediaSrc: '',
- } );
- triggerUrlUpdate();
- } }
- />
- ) }
-
- { __( 'Done', 'woo-gutenberg-products-block' ) }
-
-
-
- );
- }
+ {
+ const id = value[ 0 ] ? value[ 0 ].id : 0;
+ setAttributes( {
+ categoryId: id,
+ mediaId: 0,
+ mediaSrc: '',
+ } );
+ triggerUrlUpdate();
+ } }
+ isSingle
+ />
+ ) }
+ { name === BLOCK_NAMES.featuredProduct && (
+ {
+ const id = value[ 0 ] ? value[ 0 ].id : 0;
+ setAttributes( {
+ productId: id,
+ mediaId: 0,
+ mediaSrc: '',
+ } );
+ triggerUrlUpdate();
+ } }
+ />
+ ) }
+
+ { __( 'Done', 'woo-gutenberg-products-block' ) }
+
+
+
+ );
+ }
- return ;
-};
+ return ;
+ };
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-editing-image.tsx b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-editing-image.tsx
index 1e36e8c7738..d9e860441ef 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-editing-image.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-editing-image.tsx
@@ -15,20 +15,20 @@ interface EditingImageRequiredProps {
type EditingImageProps< T extends EditorBlock< T > > = T &
EditingImageRequiredProps;
-export const withEditingImage = < T extends EditorBlock< T > >(
- Component: ComponentType< T >
-) => ( props: EditingImageProps< T > ) => {
- const [ isEditingImage, setIsEditingImage ] = useState( false );
- const { isSelected } = props;
+export const withEditingImage =
+ < T extends EditorBlock< T > >( Component: ComponentType< T > ) =>
+ ( props: EditingImageProps< T > ) => {
+ const [ isEditingImage, setIsEditingImage ] = useState( false );
+ const { isSelected } = props;
- useEffect( () => {
- setIsEditingImage( false );
- }, [ isSelected ] );
+ useEffect( () => {
+ setIsEditingImage( false );
+ }, [ isSelected ] );
- return (
-
- );
-};
+ return (
+
+ );
+ };
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-featured-item.tsx b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-featured-item.tsx
index f411ea269c4..77130ee8a1f 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-featured-item.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-featured-item.tsx
@@ -97,227 +97,226 @@ type FeaturedItemProps< T extends EditorBlock< T > > =
| ( T & FeaturedCategoryProps< T > )
| ( T & FeaturedProductProps< T > );
-export const withFeaturedItem = ( {
- emptyMessage,
- icon,
- label,
-}: WithFeaturedItemConfig ) => < T extends EditorBlock< T > >(
- Component: ComponentType< T >
-) => ( props: FeaturedItemProps< T > ) => {
- const [ isEditingImage ] = props.useEditingImage;
+export const withFeaturedItem =
+ ( { emptyMessage, icon, label }: WithFeaturedItemConfig ) =>
+ < T extends EditorBlock< T > >( Component: ComponentType< T > ) =>
+ ( props: FeaturedItemProps< T > ) => {
+ const [ isEditingImage ] = props.useEditingImage;
- const {
- attributes,
- category,
- isLoading,
- isSelected,
- name,
- product,
- setAttributes,
- } = props;
- const { mediaId, mediaSrc } = attributes;
- const item = category || product;
- const [ backgroundImageSize, setBackgroundImageSize ] = useState( {} );
-
- const { backgroundImageSrc } = useBackgroundImage( {
- item,
- mediaId,
- mediaSrc,
- blockName: name,
- } );
-
- const className = getClassPrefixFromName( name );
-
- const onResize = useCallback(
- ( _event, _direction, elt ) => {
- setAttributes( { minHeight: parseInt( elt.style.height, 10 ) } );
- },
- [ setAttributes ]
- );
-
- const renderButton = () => {
- const { categoryId, linkText, productId } = attributes;
-
- return (
-
- );
- };
-
- const renderNoItem = () => (
- }
- label={ label }
- >
- { isLoading ? : emptyMessage }
-
- );
-
- const renderItem = () => {
const {
- contentAlign,
- dimRatio,
- focalPoint,
- hasParallax,
- isRepeated,
- imageFit,
- minHeight,
- overlayColor,
- overlayGradient,
- showDesc,
- showPrice,
- style,
- textColor,
- } = attributes;
+ attributes,
+ category,
+ isLoading,
+ isSelected,
+ name,
+ product,
+ setAttributes,
+ } = props;
+ const { mediaId, mediaSrc } = attributes;
+ const item = category || product;
+ const [ backgroundImageSize, setBackgroundImageSize ] = useState( {} );
- const classes = classnames(
- className,
- {
- 'is-selected':
- isSelected &&
- attributes.categoryId !== 'preview' &&
- attributes.productId !== 'preview',
- 'is-loading': ! item && isLoading,
- 'is-not-found': ! item && ! isLoading,
- 'has-background-dim': dimRatio !== 0,
- 'is-repeated': isRepeated,
- },
- dimRatioToClass( dimRatio ),
- contentAlign !== 'center' && `has-${ contentAlign }-content`
- );
-
- const containerStyle = {
- borderRadius: style?.border?.radius,
- color: textColor
- ? `var(--wp--preset--color--${ textColor })`
- : style?.color?.text,
- };
-
- const wrapperStyle = {
- ...getSpacingClassesAndStyles( attributes ).style,
- minHeight,
- };
-
- const isImgElement = ! isRepeated && ! hasParallax;
-
- const backgroundImageStyle = getBackgroundImageStyles( {
- focalPoint,
- imageFit,
- isImgElement,
- isRepeated,
- url: backgroundImageSrc,
+ const { backgroundImageSrc } = useBackgroundImage( {
+ item,
+ mediaId,
+ mediaSrc,
+ blockName: name,
} );
- const overlayStyle = {
- background: overlayGradient,
- backgroundColor: overlayColor,
+ const className = getClassPrefixFromName( name );
+
+ const onResize = useCallback(
+ ( _event, _direction, elt ) => {
+ setAttributes( {
+ minHeight: parseInt( elt.style.height, 10 ),
+ } );
+ },
+ [ setAttributes ]
+ );
+
+ const renderButton = () => {
+ const { categoryId, linkText, productId } = attributes;
+
+ return (
+
+ );
};
+ const renderNoItem = () => (
+ }
+ label={ label }
+ >
+ { isLoading ? : emptyMessage }
+
+ );
+
+ const renderItem = () => {
+ const {
+ contentAlign,
+ dimRatio,
+ focalPoint,
+ hasParallax,
+ isRepeated,
+ imageFit,
+ minHeight,
+ overlayColor,
+ overlayGradient,
+ showDesc,
+ showPrice,
+ style,
+ textColor,
+ } = attributes;
+
+ const classes = classnames(
+ className,
+ {
+ 'is-selected':
+ isSelected &&
+ attributes.categoryId !== 'preview' &&
+ attributes.productId !== 'preview',
+ 'is-loading': ! item && isLoading,
+ 'is-not-found': ! item && ! isLoading,
+ 'has-background-dim': dimRatio !== 0,
+ 'is-repeated': isRepeated,
+ },
+ dimRatioToClass( dimRatio ),
+ contentAlign !== 'center' && `has-${ contentAlign }-content`
+ );
+
+ const containerStyle = {
+ borderRadius: style?.border?.radius,
+ color: textColor
+ ? `var(--wp--preset--color--${ textColor })`
+ : style?.color?.text,
+ };
+
+ const wrapperStyle = {
+ ...getSpacingClassesAndStyles( attributes ).style,
+ minHeight,
+ };
+
+ const isImgElement = ! isRepeated && ! hasParallax;
+
+ const backgroundImageStyle = getBackgroundImageStyles( {
+ focalPoint,
+ imageFit,
+ isImgElement,
+ isRepeated,
+ url: backgroundImageSrc,
+ } );
+
+ const overlayStyle = {
+ background: overlayGradient,
+ backgroundColor: overlayColor,
+ };
+
+ return (
+ <>
+
+
+
+
+ { backgroundImageSrc &&
+ ( isImgElement ? (
+
{
+ setBackgroundImageSize( {
+ height: e.currentTarget
+ ?.naturalHeight,
+ width: e.currentTarget
+ ?.naturalWidth,
+ } );
+ } }
+ />
+ ) : (
+
+ ) ) }
+
+ { ! isEmpty( product?.variation ) && (
+
+ ) }
+ { showDesc && (
+
+ ) }
+ { showPrice && (
+
+ ) }
+
+ { renderButton() }
+
+
+
+ >
+ );
+ };
+
+ if ( isEditingImage ) {
+ return (
+
+ );
+ }
+
return (
<>
-
-
-
-
- { backgroundImageSrc &&
- ( isImgElement ? (
-
{
- setBackgroundImageSize( {
- height:
- e.currentTarget?.naturalHeight,
- width:
- e.currentTarget?.naturalWidth,
- } );
- } }
- />
- ) : (
-
- ) ) }
-
- { ! isEmpty( product?.variation ) && (
-
- ) }
- { showDesc && (
-
- ) }
- { showPrice && (
-
- ) }
-
- { renderButton() }
-
-
-
+ { item ? renderItem() : renderNoItem() }
>
);
};
-
- if ( isEditingImage ) {
- return (
-
- );
- }
-
- return (
- <>
-
- { item ? renderItem() : renderNoItem() }
- >
- );
-};
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-update-button-attributes.tsx b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-update-button-attributes.tsx
index 94ff7dcef64..9a58bc975d6 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-update-button-attributes.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-items/with-update-button-attributes.tsx
@@ -36,55 +36,55 @@ type WithUpdateButtonProps< T extends EditorBlock< T > > =
| ( T & WithUpdateButtonCategoryProps< T > )
| ( T & WithUpdateButtonProductProps< T > );
-export const withUpdateButtonAttributes = < T extends EditorBlock< T > >(
- Component: ComponentType< T >
-) => ( props: WithUpdateButtonProps< T > ) => {
- const [ doUrlUpdate, setDoUrlUpdate ] = useState( false );
- const { attributes, category, clientId, product } = props;
- const item = category || product;
+export const withUpdateButtonAttributes =
+ < T extends EditorBlock< T > >( Component: ComponentType< T > ) =>
+ ( props: WithUpdateButtonProps< T > ) => {
+ const [ doUrlUpdate, setDoUrlUpdate ] = useState( false );
+ const { attributes, category, clientId, product } = props;
+ const item = category || product;
- const { editMode } = attributes;
- const permalink =
- ( item as WP_REST_API_Category )?.link ||
- ( item as ProductResponseItem )?.permalink;
+ const { editMode } = attributes;
+ const permalink =
+ ( item as WP_REST_API_Category )?.link ||
+ ( item as ProductResponseItem )?.permalink;
- const Block = useSelect( ( select ) => {
- return select( 'core/block-editor' ).getBlock( clientId );
- } );
- const InnerButton = Block?.innerBlocks[ 0 ];
- const buttonBlockId = InnerButton?.clientId || '';
- const currentButtonAttributes = useMemo(
- () => InnerButton?.attributes || {},
- [ InnerButton ]
- );
- const { url } = currentButtonAttributes;
+ const Block = useSelect( ( select ) => {
+ return select( 'core/block-editor' ).getBlock( clientId );
+ } );
+ const InnerButton = Block?.innerBlocks[ 0 ];
+ const buttonBlockId = InnerButton?.clientId || '';
+ const currentButtonAttributes = useMemo(
+ () => InnerButton?.attributes || {},
+ [ InnerButton ]
+ );
+ const { url } = currentButtonAttributes;
- const { updateBlockAttributes } = useDispatch( 'core/block-editor' );
+ const { updateBlockAttributes } = useDispatch( 'core/block-editor' );
- useEffect( () => {
- if (
- doUrlUpdate &&
- buttonBlockId &&
- ! editMode &&
- permalink &&
- url &&
- permalink !== url
- ) {
- updateBlockAttributes( buttonBlockId, {
- url: permalink,
- } );
- setDoUrlUpdate( false );
- }
- }, [
- buttonBlockId,
- doUrlUpdate,
- editMode,
- permalink,
- updateBlockAttributes,
- url,
- ] );
+ useEffect( () => {
+ if (
+ doUrlUpdate &&
+ buttonBlockId &&
+ ! editMode &&
+ permalink &&
+ url &&
+ permalink !== url
+ ) {
+ updateBlockAttributes( buttonBlockId, {
+ url: permalink,
+ } );
+ setDoUrlUpdate( false );
+ }
+ }, [
+ buttonBlockId,
+ doUrlUpdate,
+ editMode,
+ permalink,
+ updateBlockAttributes,
+ url,
+ ] );
- const triggerUrlUpdate = () => setDoUrlUpdate( true );
+ const triggerUrlUpdate = () => setDoUrlUpdate( true );
- return ;
-};
+ return ;
+ };
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/handpicked-products/block.json b/plugins/woocommerce-blocks/assets/js/blocks/handpicked-products/block.json
index 7e0629c907f..b6819377598 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/handpicked-products/block.json
+++ b/plugins/woocommerce-blocks/assets/js/blocks/handpicked-products/block.json
@@ -1,86 +1,80 @@
{
- "name": "woocommerce/handpicked-products",
- "title": "Hand-picked Products",
- "category": "woocommerce",
- "keywords": [
- "Handpicked Products",
- "WooCommerce"
- ],
- "description": "Display a selection of hand-picked products in a grid.",
- "supports": {
- "align": [
- "wide",
- "full"
- ],
- "html": false
- },
- "attributes": {
- "align": {
- "type": "string"
- },
- "columns": {
- "type": "number",
- "default": 3
- },
- "contentVisibility": {
- "type": "object",
- "default": {
- "image": true,
- "title": true,
- "price": true,
- "rating": true,
- "button": true
- },
- "properties": {
- "image": {
- "type": "boolean",
- "image": true
- },
- "title": {
- "type": "boolean",
- "title": true
- },
- "price": {
- "type": "boolean",
- "price": true
- },
- "rating": {
- "type": "boolean",
- "rating": true
- },
- "button": {
- "type": "boolean",
- "button": true
- }
- }
- },
- "orderby": {
- "type": "string",
- "enum": [
- "date",
- "popularity",
- "price_asc",
- "price_desc",
- "rating",
- "title",
- "menu_order"
- ],
- "default": "date"
- },
- "products": {
- "type": "array",
- "default": []
- },
- "alignButtons": {
- "type": "boolean",
- "default": false
- },
- "isPreview": {
- "type": "boolean",
- "default": false
- }
- },
- "textdomain": "woo-gutenberg-products-block",
- "apiVersion": 2,
- "$schema": "https://schemas.wp.org/trunk/block.json"
+ "name": "woocommerce/handpicked-products",
+ "title": "Hand-picked Products",
+ "category": "woocommerce",
+ "keywords": [ "Handpicked Products", "WooCommerce" ],
+ "description": "Display a selection of hand-picked products in a grid.",
+ "supports": {
+ "align": [ "wide", "full" ],
+ "html": false
+ },
+ "attributes": {
+ "align": {
+ "type": "string"
+ },
+ "columns": {
+ "type": "number",
+ "default": 3
+ },
+ "contentVisibility": {
+ "type": "object",
+ "default": {
+ "image": true,
+ "title": true,
+ "price": true,
+ "rating": true,
+ "button": true
+ },
+ "properties": {
+ "image": {
+ "type": "boolean",
+ "image": true
+ },
+ "title": {
+ "type": "boolean",
+ "title": true
+ },
+ "price": {
+ "type": "boolean",
+ "price": true
+ },
+ "rating": {
+ "type": "boolean",
+ "rating": true
+ },
+ "button": {
+ "type": "boolean",
+ "button": true
+ }
+ }
+ },
+ "orderby": {
+ "type": "string",
+ "enum": [
+ "date",
+ "popularity",
+ "price_asc",
+ "price_desc",
+ "rating",
+ "title",
+ "menu_order"
+ ],
+ "default": "date"
+ },
+ "products": {
+ "type": "array",
+ "default": []
+ },
+ "alignButtons": {
+ "type": "boolean",
+ "default": false
+ },
+ "isPreview": {
+ "type": "boolean",
+ "default": false
+ }
+ },
+ "textdomain": "woo-gutenberg-products-block",
+ "apiVersion": 2,
+ "$schema": "https://schemas.wp.org/trunk/block.json"
}
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/block.tsx
index 8fb3025523f..9c73f54ea0f 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/block.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/block.tsx
@@ -67,9 +67,8 @@ const MiniCartBlock = ( {
const [ isOpen, setIsOpen ] = useState< boolean >( isInitiallyOpen );
// We already rendered the HTML drawer placeholder, so we want to skip the
// slide in animation.
- const [ skipSlideIn, setSkipSlideIn ] = useState< boolean >(
- isInitiallyOpen
- );
+ const [ skipSlideIn, setSkipSlideIn ] =
+ useState< boolean >( isInitiallyOpen );
const [ contentsNode, setContentsNode ] = useState< HTMLDivElement | null >(
null
);
@@ -154,11 +153,12 @@ const MiniCartBlock = ( {
isBoolean
);
- const preFetchedCartTotals = getSettingWithCoercion< CartResponseTotals | null >(
- 'cartTotals',
- null,
- isCartResponseTotals
- );
+ const preFetchedCartTotals =
+ getSettingWithCoercion< CartResponseTotals | null >(
+ 'cartTotals',
+ null,
+ isCartResponseTotals
+ );
const preFetchedCartItemsCount = getSettingWithCoercion< number >(
'cartItemsCount',
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx
index 2c8c3db875f..d991483cacd 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx
@@ -20,11 +20,11 @@ export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {
const allowedBlocks = getAllowedBlocks( innerBlockAreas.FILLED_MINI_CART );
const { currentView } = useEditorContext();
- const defaultTemplate = ( [
+ const defaultTemplate = [
[ 'woocommerce/mini-cart-title-block', {} ],
[ 'woocommerce/mini-cart-items-block', {} ],
[ 'woocommerce/mini-cart-footer-block', {} ],
- ].filter( Boolean ) as unknown ) as TemplateArray;
+ ].filter( Boolean ) as unknown as TemplateArray;
useForcedLayout( {
clientId,
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx
index dd7b4fcdb91..6005b8e74f3 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx
@@ -14,9 +14,9 @@ export const Edit = (): JSX.Element => {
className: 'wc-block-mini-cart__items',
} );
- const defaultTemplate = ( [
+ const defaultTemplate = [
[ 'woocommerce/mini-cart-products-table-block', {} ],
- ].filter( Boolean ) as unknown ) as TemplateArray;
+ ].filter( Boolean ) as unknown as TemplateArray;
return (
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/register-components.ts b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/register-components.ts
index d29a13b2d83..79aa25254e3 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/register-components.ts
+++ b/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/register-components.ts
@@ -21,63 +21,70 @@ __webpack_public_path__ = WC_BLOCKS_BUILD_URL;
registerCheckoutBlock( {
metadata: filledMiniCartMetadata,
- component: lazy( () =>
- import(
- /* webpackChunkName: "mini-cart-contents-block/filled-cart" */ './filled-mini-cart-contents-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "mini-cart-contents-block/filled-cart" */ './filled-mini-cart-contents-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: emptyMiniCartContentsMetadata,
- component: lazy( () =>
- import(
- /* webpackChunkName: "mini-cart-contents-block/empty-cart" */ './empty-mini-cart-contents-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "mini-cart-contents-block/empty-cart" */ './empty-mini-cart-contents-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: miniCartTitleMetadata,
- component: lazy( () =>
- import(
- /* webpackChunkName: "mini-cart-contents-block/title" */ './mini-cart-title-block/block'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "mini-cart-contents-block/title" */ './mini-cart-title-block/block'
+ )
),
} );
registerCheckoutBlock( {
metadata: miniCartItemsMetadata,
- component: lazy( () =>
- import(
- /* webpackChunkName: "mini-cart-contents-block/items" */ './mini-cart-items-block/frontend'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "mini-cart-contents-block/items" */ './mini-cart-items-block/frontend'
+ )
),
} );
registerCheckoutBlock( {
metadata: miniCartProductsTableMetadata,
- component: lazy( () =>
- import(
- /* webpackChunkName: "mini-cart-contents-block/products-table" */ './mini-cart-products-table-block/block'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "mini-cart-contents-block/products-table" */ './mini-cart-products-table-block/block'
+ )
),
} );
registerCheckoutBlock( {
metadata: miniCartFooterMetadata,
- component: lazy( () =>
- import(
- /* webpackChunkName: "mini-cart-contents-block/footer" */ './mini-cart-footer-block/block'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "mini-cart-contents-block/footer" */ './mini-cart-footer-block/block'
+ )
),
} );
registerCheckoutBlock( {
metadata: miniCartShoppingButtonMetadata,
- component: lazy( () =>
- import(
- /* webpackChunkName: "mini-cart-contents-block/shopping-button" */ './mini-cart-shopping-button-block/block'
- )
+ component: lazy(
+ () =>
+ import(
+ /* webpackChunkName: "mini-cart-contents-block/shopping-button" */ './mini-cart-shopping-button-block/block'
+ )
),
} );
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/price-filter/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/price-filter/block.tsx
index 750b5b273e6..7568ff3ac3c 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/price-filter/block.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/price-filter/block.tsx
@@ -100,9 +100,8 @@ const PriceFilterBlock = ( {
* Important: Only used on the PHP rendered Block pages to track
* the price filter defaults coming from the URL
*/
- const [ hasSetPhpFilterDefaults, setHasSetPhpFilterDefaults ] = useState(
- false
- );
+ const [ hasSetPhpFilterDefaults, setHasSetPhpFilterDefaults ] =
+ useState( false );
const minPriceParam = getUrlParameter( 'min_price' );
const maxPriceParam = getUrlParameter( 'max_price' );
@@ -315,7 +314,8 @@ const PriceFilterBlock = ( {
return null;
}
- const TagName = `h${ attributes.headingLevel }` as keyof JSX.IntrinsicElements;
+ const TagName =
+ `h${ attributes.headingLevel }` as keyof JSX.IntrinsicElements;
return (
<>
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/price-filter/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/price-filter/edit.tsx
index f58e6f422a7..df830023625 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/price-filter/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/price-filter/edit.tsx
@@ -32,12 +32,8 @@ export default function ( {
attributes,
setAttributes,
}: BlockEditProps< Attributes > ) {
- const {
- heading,
- headingLevel,
- showInputFields,
- showFilterButton,
- } = attributes;
+ const { heading, headingLevel, showInputFields, showFilterButton } =
+ attributes;
const blockProps = useBlockProps();
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/product-categories/block.js b/plugins/woocommerce-blocks/assets/js/blocks/product-categories/block.js
index 725ab502324..854d1565734 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/product-categories/block.js
+++ b/plugins/woocommerce-blocks/assets/js/blocks/product-categories/block.js
@@ -43,13 +43,8 @@ const EmptyPlaceholder = () => (
*/
const ProductCategoriesBlock = ( { attributes, setAttributes, name } ) => {
const getInspectorControls = () => {
- const {
- hasCount,
- hasImage,
- hasEmpty,
- isDropdown,
- isHierarchical,
- } = attributes;
+ const { hasCount, hasImage, hasEmpty, isDropdown, isHierarchical } =
+ attributes;
return (
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/product-categories/index.js b/plugins/woocommerce-blocks/assets/js/blocks/product-categories/index.js
index 270524f0a02..9715d879d34 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/product-categories/index.js
+++ b/plugins/woocommerce-blocks/assets/js/blocks/product-categories/index.js
@@ -156,12 +156,8 @@ registerBlockType( 'woocommerce/product-categories', {
return attributes;
},
save( props ) {
- const {
- hasCount,
- hasEmpty,
- isDropdown,
- isHierarchical,
- } = props.attributes;
+ const { hasCount, hasEmpty, isDropdown, isHierarchical } =
+ props.attributes;
const data = {};
if ( hasCount ) {
data[ 'data-has-count' ] = true;
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/product-tag/block.json b/plugins/woocommerce-blocks/assets/js/blocks/product-tag/block.json
index bcfd346e9fa..04edc01d402 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/product-tag/block.json
+++ b/plugins/woocommerce-blocks/assets/js/blocks/product-tag/block.json
@@ -1,89 +1,84 @@
{
- "name": "woocommerce/product-tag",
- "title": "Products by Tag",
- "category": "woocommerce",
- "keywords": [
- "WooCommerce"
- ],
- "description": "Display a grid of products with selected tags.",
- "supports": {
- "align": [
- "wide",
- "full"
- ],
- "html": false
- },
- "attributes": {
- "columns": {
- "type": "number",
- "default": 3
- },
- "rows": {
- "type": "number",
- "default": 3
- },
- "alignButtons": {
- "type": "boolean",
- "default": false
- },
- "contentVisibility": {
- "type": "object",
- "default": {
- "image": true,
- "title": true,
- "price": true,
- "rating": true,
- "button": true
- },
- "properties": {
- "image": {
- "type": "boolean",
- "default": true
- },
- "title": {
- "type": "boolean",
- "default": true
- },
- "price": {
- "type": "boolean",
- "default": true
- },
- "rating": {
- "type": "boolean",
- "default": true
- },
- "button": {
- "type": "boolean",
- "default": true
- }
- }
- },
- "tags": {
- "type": "array",
- "default": []
- },
- "tagOperator": {
- "type": "string",
- "default": "any"
- },
- "orderby": {
- "type": "string",
- "default": "date"
- },
- "isPreview": {
- "type": "boolean",
- "default": false
- },
- "stockStatus": {
- "type": "array"
- }
- },
- "example": {
- "attributes": {
- "isPreview": true
- }
- },
- "textdomain": "woo-gutenberg-products-block",
- "apiVersion": 2,
- "$schema": "https://schemas.wp.org/trunk/block.json"
+ "name": "woocommerce/product-tag",
+ "title": "Products by Tag",
+ "category": "woocommerce",
+ "keywords": [ "WooCommerce" ],
+ "description": "Display a grid of products with selected tags.",
+ "supports": {
+ "align": [ "wide", "full" ],
+ "html": false
+ },
+ "attributes": {
+ "columns": {
+ "type": "number",
+ "default": 3
+ },
+ "rows": {
+ "type": "number",
+ "default": 3
+ },
+ "alignButtons": {
+ "type": "boolean",
+ "default": false
+ },
+ "contentVisibility": {
+ "type": "object",
+ "default": {
+ "image": true,
+ "title": true,
+ "price": true,
+ "rating": true,
+ "button": true
+ },
+ "properties": {
+ "image": {
+ "type": "boolean",
+ "default": true
+ },
+ "title": {
+ "type": "boolean",
+ "default": true
+ },
+ "price": {
+ "type": "boolean",
+ "default": true
+ },
+ "rating": {
+ "type": "boolean",
+ "default": true
+ },
+ "button": {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "tags": {
+ "type": "array",
+ "default": []
+ },
+ "tagOperator": {
+ "type": "string",
+ "default": "any"
+ },
+ "orderby": {
+ "type": "string",
+ "default": "date"
+ },
+ "isPreview": {
+ "type": "boolean",
+ "default": false
+ },
+ "stockStatus": {
+ "type": "array"
+ }
+ },
+ "example": {
+ "attributes": {
+ "isPreview": true
+ }
+ },
+ "textdomain": "woo-gutenberg-products-block",
+ "apiVersion": 2,
+ "$schema": "https://schemas.wp.org/trunk/block.json"
}
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/products-by-attribute/block.json b/plugins/woocommerce-blocks/assets/js/blocks/products-by-attribute/block.json
index 09ab00fddc6..968e28868f0 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/products-by-attribute/block.json
+++ b/plugins/woocommerce-blocks/assets/js/blocks/products-by-attribute/block.json
@@ -1,94 +1,89 @@
{
- "name": "woocommerce/products-by-attribute",
- "title": "Products by Attribute",
- "category": "woocommerce",
- "keywords": [
- "WooCommerce"
- ],
- "description": "Display a grid of products with selected attributes.",
- "supports": {
- "align": [
- "wide",
- "full"
- ],
- "html": false
- },
- "attributes": {
- "attributes": {
- "type": "array",
- "default": []
- },
- "attrOperator": {
- "type": "string",
- "enum": [ "all", "any" ],
- "default": "any"
- },
- "columns": {
- "type": "number",
- "default": 3
- },
- "contentVisibility": {
- "type": "object",
- "default": {
- "image": true,
- "title": true,
- "price": true,
- "rating": true,
- "button": true
- },
- "properties": {
- "image": {
- "type": "boolean",
- "default": true
- },
- "title": {
- "type": "boolean",
- "default": true
- },
- "price": {
- "type": "boolean",
- "default": true
- },
- "rating": {
- "type": "boolean",
- "default": true
- },
- "button": {
- "type": "boolean",
- "default": true
- }
- }
- },
- "orderby": {
- "type": "string",
- "enum": [
- "date",
- "popularity",
- "price_asc",
- "price_desc",
- "rating",
- "title",
- "menu_order"
- ],
- "default": "date"
- },
- "rows": {
- "type": "number",
- "default": 3
- },
- "alignButtons": {
- "type": "boolean",
- "default": false
- },
- "isPreview": {
- "type": "boolean",
- "default": false
- },
- "stockStatus": {
- "type": "array"
- }
- },
- "textdomain": "woo-gutenberg-products-block",
- "apiVersion": 2,
- "$schema": "https://schemas.wp.org/trunk/block.json"
+ "name": "woocommerce/products-by-attribute",
+ "title": "Products by Attribute",
+ "category": "woocommerce",
+ "keywords": [ "WooCommerce" ],
+ "description": "Display a grid of products with selected attributes.",
+ "supports": {
+ "align": [ "wide", "full" ],
+ "html": false
+ },
+ "attributes": {
+ "attributes": {
+ "type": "array",
+ "default": []
+ },
+ "attrOperator": {
+ "type": "string",
+ "enum": [ "all", "any" ],
+ "default": "any"
+ },
+ "columns": {
+ "type": "number",
+ "default": 3
+ },
+ "contentVisibility": {
+ "type": "object",
+ "default": {
+ "image": true,
+ "title": true,
+ "price": true,
+ "rating": true,
+ "button": true
+ },
+ "properties": {
+ "image": {
+ "type": "boolean",
+ "default": true
+ },
+ "title": {
+ "type": "boolean",
+ "default": true
+ },
+ "price": {
+ "type": "boolean",
+ "default": true
+ },
+ "rating": {
+ "type": "boolean",
+ "default": true
+ },
+ "button": {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "orderby": {
+ "type": "string",
+ "enum": [
+ "date",
+ "popularity",
+ "price_asc",
+ "price_desc",
+ "rating",
+ "title",
+ "menu_order"
+ ],
+ "default": "date"
+ },
+ "rows": {
+ "type": "number",
+ "default": 3
+ },
+ "alignButtons": {
+ "type": "boolean",
+ "default": false
+ },
+ "isPreview": {
+ "type": "boolean",
+ "default": false
+ },
+ "stockStatus": {
+ "type": "array"
+ }
+ },
+ "textdomain": "woo-gutenberg-products-block",
+ "apiVersion": 2,
+ "$schema": "https://schemas.wp.org/trunk/block.json"
}
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/stock-filter/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/stock-filter/block.tsx
index 633e2cbdd81..00344a3ac61 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/stock-filter/block.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/stock-filter/block.tsx
@@ -56,9 +56,8 @@ const StockStatusFilterBlock = ( {
isBoolean
);
- const [ hasSetPhpFilterDefaults, setHasSetPhpFilterDefaults ] = useState(
- false
- );
+ const [ hasSetPhpFilterDefaults, setHasSetPhpFilterDefaults ] =
+ useState( false );
const { outofstock, ...otherStockStatusOptions } = getSetting(
'stockStatusOptions',
@@ -86,18 +85,14 @@ const StockStatusFilterBlock = ( {
);
const [ queryState ] = useQueryStateByContext();
- const [
- productStockStatusQuery,
- setProductStockStatusQuery,
- ] = useQueryStateByKey( 'stock_status', [] );
+ const [ productStockStatusQuery, setProductStockStatusQuery ] =
+ useQueryStateByKey( 'stock_status', [] );
- const {
- results: filteredCounts,
- isLoading: filteredCountsLoading,
- } = useCollectionData( {
- queryStock: true,
- queryState,
- } );
+ const { results: filteredCounts, isLoading: filteredCountsLoading } =
+ useCollectionData( {
+ queryStock: true,
+ queryState,
+ } );
/**
* Get count data about a given status by slug.
@@ -354,7 +349,8 @@ const StockStatusFilterBlock = ( {
return null;
}
- const TagName = `h${ blockAttributes.headingLevel }` as keyof JSX.IntrinsicElements;
+ const TagName =
+ `h${ blockAttributes.headingLevel }` as keyof JSX.IntrinsicElements;
const isLoading =
! blockAttributes.isPreview && ! STOCK_STATUS_OPTIONS.current;
const isDisabled = ! blockAttributes.isPreview && filteredCountsLoading;
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/stock-filter/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/stock-filter/edit.tsx
index e754763f39a..05bdf6dd6b1 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/stock-filter/edit.tsx
+++ b/plugins/woocommerce-blocks/assets/js/blocks/stock-filter/edit.tsx
@@ -25,13 +25,8 @@ const Edit = ( {
attributes,
setAttributes,
}: BlockEditProps< Attributes > ) => {
- const {
- className,
- heading,
- headingLevel,
- showCounts,
- showFilterButton,
- } = attributes;
+ const { className, heading, headingLevel, showCounts, showFilterButton } =
+ attributes;
const blockProps = useBlockProps( {
className: classnames( 'wc-block-stock-filter', className ),
diff --git a/plugins/woocommerce-blocks/assets/js/data/cart/actions.ts b/plugins/woocommerce-blocks/assets/js/data/cart/actions.ts
index 05ac2b2ee5c..2b5afb94816 100644
--- a/plugins/woocommerce-blocks/assets/js/data/cart/actions.ts
+++ b/plugins/woocommerce-blocks/assets/js/data/cart/actions.ts
@@ -33,9 +33,9 @@ import { ReturnOrGeneratorYieldUnion } from '../mapped-types';
export const receiveCart = (
response: CartResponse
): { type: string; response: Cart } => {
- const cart = ( mapKeys( response, ( _, key ) =>
+ const cart = mapKeys( response, ( _, key ) =>
camelCase( key )
- ) as unknown ) as Cart;
+ ) as unknown as Cart;
return {
type: types.RECEIVE_CART,
response: cart,
@@ -55,9 +55,9 @@ export const receiveCart = (
export const receiveCartContents = (
response: CartResponse
): { type: string; response: Partial< Cart > } => {
- const cart = ( mapKeys( response, ( _, key ) =>
+ const cart = mapKeys( response, ( _, key ) =>
camelCase( key )
- ) as unknown ) as Cart;
+ ) as unknown as Cart;
const { shippingAddress, billingAddress, ...cartWithoutAddress } = cart;
return {
type: types.RECEIVE_CART,
diff --git a/plugins/woocommerce-blocks/assets/js/data/cart/index.ts b/plugins/woocommerce-blocks/assets/js/data/cart/index.ts
index a4bc7a8b98b..a17a1d490c3 100644
--- a/plugins/woocommerce-blocks/assets/js/data/cart/index.ts
+++ b/plugins/woocommerce-blocks/assets/js/data/cart/index.ts
@@ -34,9 +34,9 @@ declare module '@wordpress/data' {
function dispatch(
key: typeof CART_STORE_KEY
): DispatchFromMap< typeof actions >;
- function select(
- key: typeof CART_STORE_KEY
- ): SelectFromMap< typeof selectors > & {
+ function select( key: typeof CART_STORE_KEY ): SelectFromMap<
+ typeof selectors
+ > & {
hasFinishedResolution: ( selector: string ) => boolean;
};
}
diff --git a/plugins/woocommerce-blocks/assets/js/data/cart/test/selectors.js b/plugins/woocommerce-blocks/assets/js/data/cart/test/selectors.js
index 66d6bfa54fa..f38bcd567ef 100644
--- a/plugins/woocommerce-blocks/assets/js/data/cart/test/selectors.js
+++ b/plugins/woocommerce-blocks/assets/js/data/cart/test/selectors.js
@@ -45,12 +45,10 @@ const state = {
images: [
{
id: 48,
- src:
- 'http://local.wordpress.test/wp-content/uploads/2019/12/album-1.jpg',
+ src: 'http://local.wordpress.test/wp-content/uploads/2019/12/album-1.jpg',
thumbnail:
'http://local.wordpress.test/wp-content/uploads/2019/12/album-1-324x324.jpg',
- srcset:
- 'http://local.wordpress.test/wp-content/uploads/2019/12/album-1.jpg 800w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-324x324.jpg 324w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-100x100.jpg 100w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-416x416.jpg 416w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-300x300.jpg 300w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-150x150.jpg 150w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-768x768.jpg 768w',
+ srcset: 'http://local.wordpress.test/wp-content/uploads/2019/12/album-1.jpg 800w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-324x324.jpg 324w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-100x100.jpg 100w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-416x416.jpg 416w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-300x300.jpg 300w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-150x150.jpg 150w, http://local.wordpress.test/wp-content/uploads/2019/12/album-1-768x768.jpg 768w',
sizes: '(max-width: 800px) 100vw, 800px',
name: 'album-1.jpg',
alt: '',
@@ -85,12 +83,10 @@ const state = {
images: [
{
id: 40,
- src:
- 'http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2.jpg',
+ src: 'http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2.jpg',
thumbnail:
'http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-324x324.jpg',
- srcset:
- 'http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2.jpg 801w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-324x324.jpg 324w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-100x100.jpg 100w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-416x416.jpg 416w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-300x300.jpg 300w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-150x150.jpg 150w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-768x768.jpg 768w',
+ srcset: 'http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2.jpg 801w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-324x324.jpg 324w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-100x100.jpg 100w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-416x416.jpg 416w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-300x300.jpg 300w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-150x150.jpg 150w, http://local.wordpress.test/wp-content/uploads/2019/12/beanie-2-768x768.jpg 768w',
sizes: '(max-width: 801px) 100vw, 801px',
name: 'beanie-2.jpg',
alt: '',
diff --git a/plugins/woocommerce-blocks/assets/js/data/collections/resolvers.js b/plugins/woocommerce-blocks/assets/js/data/collections/resolvers.js
index 86b6109bdc0..5a1a37f6689 100644
--- a/plugins/woocommerce-blocks/assets/js/data/collections/resolvers.js
+++ b/plugins/woocommerce-blocks/assets/js/data/collections/resolvers.js
@@ -54,10 +54,8 @@ export function* getCollection( namespace, resourceName, query, ids ) {
}
try {
- const {
- response = DEFAULT_EMPTY_ARRAY,
- headers,
- } = yield apiFetchWithHeaders( { path: route + queryString } );
+ const { response = DEFAULT_EMPTY_ARRAY, headers } =
+ yield apiFetchWithHeaders( { path: route + queryString } );
if ( headers && headers.get && headers.has( 'last-modified' ) ) {
// Do any invalidation before the collection is received to prevent
diff --git a/plugins/woocommerce-blocks/assets/js/data/constants.ts b/plugins/woocommerce-blocks/assets/js/data/constants.ts
index 339cf2557a7..996dbbd8105 100644
--- a/plugins/woocommerce-blocks/assets/js/data/constants.ts
+++ b/plugins/woocommerce-blocks/assets/js/data/constants.ts
@@ -5,12 +5,12 @@
*/
export const API_BLOCK_NAMESPACE = 'wc/blocks';
-export const EMPTY_CART_COUPONS: [ ] = [];
-export const EMPTY_CART_ITEMS: [ ] = [];
-export const EMPTY_CART_FEES: [ ] = [];
-export const EMPTY_CART_ITEM_ERRORS: [ ] = [];
-export const EMPTY_CART_ERRORS: [ ] = [];
-export const EMPTY_SHIPPING_RATES: [ ] = [];
-export const EMPTY_PAYMENT_REQUIREMENTS: [ ] = [];
+export const EMPTY_CART_COUPONS: [] = [];
+export const EMPTY_CART_ITEMS: [] = [];
+export const EMPTY_CART_FEES: [] = [];
+export const EMPTY_CART_ITEM_ERRORS: [] = [];
+export const EMPTY_CART_ERRORS: [] = [];
+export const EMPTY_SHIPPING_RATES: [] = [];
+export const EMPTY_PAYMENT_REQUIREMENTS: [] = [];
export const EMPTY_EXTENSIONS: Record< string, unknown > = {};
-export const EMPTY_TAX_LINES: [ ] = [];
+export const EMPTY_TAX_LINES: [] = [];
diff --git a/plugins/woocommerce-blocks/assets/js/data/default-states.ts b/plugins/woocommerce-blocks/assets/js/data/default-states.ts
index 29ff0e7fe79..8fe8ec2b698 100644
--- a/plugins/woocommerce-blocks/assets/js/data/default-states.ts
+++ b/plugins/woocommerce-blocks/assets/js/data/default-states.ts
@@ -27,8 +27,8 @@ export interface CartState {
errors: Array< ResponseError >;
}
-export const EMPTY_PENDING_QUANTITY: [ ] = [];
-export const EMPTY_PENDING_DELETE: [ ] = [];
+export const EMPTY_PENDING_QUANTITY: [] = [];
+export const EMPTY_PENDING_DELETE: [] = [];
export const defaultCartState: CartState = {
cartItemsPendingQuantity: EMPTY_PENDING_QUANTITY,
diff --git a/plugins/woocommerce-blocks/assets/js/data/mapped-types.ts b/plugins/woocommerce-blocks/assets/js/data/mapped-types.ts
index ec447656341..01c711c8653 100644
--- a/plugins/woocommerce-blocks/assets/js/data/mapped-types.ts
+++ b/plugins/woocommerce-blocks/assets/js/data/mapped-types.ts
@@ -62,19 +62,17 @@ export type TailParameters< F extends Function > = F extends (
/**
* Obtain the type finally returned by the generator when it's done iterating.
*/
-export type GeneratorReturnType<
- T extends ( ...args: any[] ) => Generator
-> = T extends ( ...args: any ) => Generator< any, infer R, any > ? R : never;
+export type GeneratorReturnType< T extends ( ...args: any[] ) => Generator > =
+ T extends ( ...args: any ) => Generator< any, infer R, any > ? R : never;
/**
* Usually we use ReturnType of all the action creators to deduce all the actions.
* This works until one of the action creators is a generator and doesn't actually "Return" an action.
* This type helper allows for actions to be both functions and generators
*/
-export type ReturnOrGeneratorYieldUnion<
- T extends ( ...args: any ) => any
-> = T extends ( ...args: any ) => infer Return
- ? Return extends Generator< infer T, infer U, any >
- ? T | U
- : Return
- : never;
+export type ReturnOrGeneratorYieldUnion< T extends ( ...args: any ) => any > =
+ T extends ( ...args: any ) => infer Return
+ ? Return extends Generator< infer T, infer U, any >
+ ? T | U
+ : Return
+ : never;
diff --git a/plugins/woocommerce-blocks/assets/js/data/schema/selectors.js b/plugins/woocommerce-blocks/assets/js/data/schema/selectors.js
index 9d85b64b60b..92f45285582 100644
--- a/plugins/woocommerce-blocks/assets/js/data/schema/selectors.js
+++ b/plugins/woocommerce-blocks/assets/js/data/schema/selectors.js
@@ -32,47 +32,49 @@ import { STORE_KEY } from './constants';
* @return {string} The route if it is available.
*/
export const getRoute = createRegistrySelector(
- ( select ) => ( state, namespace, resourceName, ids = [] ) => {
- const hasResolved = select(
- STORE_KEY
- ).hasFinishedResolution( 'getRoutes', [ namespace ] );
- state = state.routes;
- let error = '';
- if ( ! state[ namespace ] ) {
- error = sprintf(
- 'There is no route for the given namespace (%s) in the store',
- namespace
+ ( select ) =>
+ ( state, namespace, resourceName, ids = [] ) => {
+ const hasResolved = select( STORE_KEY ).hasFinishedResolution(
+ 'getRoutes',
+ [ namespace ]
);
- } else if ( ! state[ namespace ][ resourceName ] ) {
- error = sprintf(
- 'There is no route for the given resource name (%s) in the store',
- resourceName
- );
- }
- if ( error !== '' ) {
- if ( hasResolved ) {
- throw new Error( error );
- }
- return '';
- }
- const route = getRouteFromResourceEntries(
- state[ namespace ][ resourceName ],
- ids
- );
- if ( route === '' ) {
- if ( hasResolved ) {
- throw new Error(
- sprintf(
- 'While there is a route for the given namespace (%1$s) and resource name (%2$s), there is no route utilizing the number of ids you included in the select arguments. The available routes are: (%3$s)',
- namespace,
- resourceName,
- JSON.stringify( state[ namespace ][ resourceName ] )
- )
+ state = state.routes;
+ let error = '';
+ if ( ! state[ namespace ] ) {
+ error = sprintf(
+ 'There is no route for the given namespace (%s) in the store',
+ namespace
+ );
+ } else if ( ! state[ namespace ][ resourceName ] ) {
+ error = sprintf(
+ 'There is no route for the given resource name (%s) in the store',
+ resourceName
);
}
+ if ( error !== '' ) {
+ if ( hasResolved ) {
+ throw new Error( error );
+ }
+ return '';
+ }
+ const route = getRouteFromResourceEntries(
+ state[ namespace ][ resourceName ],
+ ids
+ );
+ if ( route === '' ) {
+ if ( hasResolved ) {
+ throw new Error(
+ sprintf(
+ 'While there is a route for the given namespace (%1$s) and resource name (%2$s), there is no route utilizing the number of ids you included in the select arguments. The available routes are: (%3$s)',
+ namespace,
+ resourceName,
+ JSON.stringify( state[ namespace ][ resourceName ] )
+ )
+ );
+ }
+ }
+ return route;
}
- return route;
- }
);
/**
@@ -85,9 +87,10 @@ export const getRoute = createRegistrySelector(
*/
export const getRoutes = createRegistrySelector(
( select ) => ( state, namespace ) => {
- const hasResolved = select(
- STORE_KEY
- ).hasFinishedResolution( 'getRoutes', [ namespace ] );
+ const hasResolved = select( STORE_KEY ).hasFinishedResolution(
+ 'getRoutes',
+ [ namespace ]
+ );
const routes = state.routes[ namespace ];
if ( ! routes ) {
if ( hasResolved ) {
diff --git a/plugins/woocommerce-blocks/assets/js/data/schema/test/selectors.js b/plugins/woocommerce-blocks/assets/js/data/schema/test/selectors.js
index ded81504bfe..0e7bc205cff 100644
--- a/plugins/woocommerce-blocks/assets/js/data/schema/test/selectors.js
+++ b/plugins/woocommerce-blocks/assets/js/data/schema/test/selectors.js
@@ -34,9 +34,11 @@ const testState = deepFreeze( {
} );
describe( 'getRoute', () => {
- const invokeTest = ( namespace, resourceName, ids = [] ) => () => {
- return getRoute( testState, namespace, resourceName, ids );
- };
+ const invokeTest =
+ ( namespace, resourceName, ids = [] ) =>
+ () => {
+ return getRoute( testState, namespace, resourceName, ids );
+ };
describe( 'with throwing errors', () => {
beforeEach( () => mockHasFinishedResolution.mockReturnValue( true ) );
it( 'throws an error if there is no route for the given namespace', () => {
@@ -78,10 +80,11 @@ describe( 'getRoute', () => {
} );
test( 'when there is a route with placeholders', () => {
expect(
- invokeTest( 'wc/blocks', 'products/attributes/terms', [
- 10,
- 20,
- ] )()
+ invokeTest(
+ 'wc/blocks',
+ 'products/attributes/terms',
+ [ 10, 20 ]
+ )()
).toBe( 'wc/blocks/products/attributes/10/terms/20' );
} );
} );
diff --git a/plugins/woocommerce-blocks/assets/js/editor-components/external-link-card/stories/index.tsx b/plugins/woocommerce-blocks/assets/js/editor-components/external-link-card/stories/index.tsx
index 276d916b267..6c1f23fbd71 100644
--- a/plugins/woocommerce-blocks/assets/js/editor-components/external-link-card/stories/index.tsx
+++ b/plugins/woocommerce-blocks/assets/js/editor-components/external-link-card/stories/index.tsx
@@ -21,7 +21,6 @@ export const Default = Template.bind( {} );
Default.args = {
description:
'This is the description of the link, perhaps a bit of a longer paragraph or a summary of a blog post, or whatever could give more context',
- href:
- 'https://woocommerce.com/posts/seven-tips-to-extend-holiday-sales-momentum/',
+ href: 'https://woocommerce.com/posts/seven-tips-to-extend-holiday-sales-momentum/',
title: 'Seven tips to extend holiday sales momentum',
};
diff --git a/plugins/woocommerce-blocks/assets/js/editor-components/product-tag-control/index.js b/plugins/woocommerce-blocks/assets/js/editor-components/product-tag-control/index.js
index a2386d6f7e3..0b6ed524227 100644
--- a/plugins/woocommerce-blocks/assets/js/editor-components/product-tag-control/index.js
+++ b/plugins/woocommerce-blocks/assets/js/editor-components/product-tag-control/index.js
@@ -93,13 +93,8 @@ class ProductTagControl extends Component {
render() {
const { list, loading } = this.state;
- const {
- isCompact,
- onChange,
- onOperatorChange,
- operator,
- selected,
- } = this.props;
+ const { isCompact, onChange, onOperatorChange, operator, selected } =
+ this.props;
const messages = {
clear: __(
diff --git a/plugins/woocommerce-blocks/assets/js/editor-components/search-list-control/types.ts b/plugins/woocommerce-blocks/assets/js/editor-components/search-list-control/types.ts
index 6c01296eb49..c1737693c54 100644
--- a/plugins/woocommerce-blocks/assets/js/editor-components/search-list-control/types.ts
+++ b/plugins/woocommerce-blocks/assets/js/editor-components/search-list-control/types.ts
@@ -13,7 +13,7 @@ export type SearchListItemType = {
breadcrumbs: string[];
};
-export type SearchListItemsType = SearchListItemType[] | [ ];
+export type SearchListItemsType = SearchListItemType[] | [];
export interface SearchListMessages {
// A more detailed label for the "Clear all" button, read to screen reader users.
diff --git a/plugins/woocommerce-blocks/assets/js/editor-components/search-list-control/utils.tsx b/plugins/woocommerce-blocks/assets/js/editor-components/search-list-control/utils.tsx
index 43c65adfbee..f98d8796f26 100644
--- a/plugins/woocommerce-blocks/assets/js/editor-components/search-list-control/utils.tsx
+++ b/plugins/woocommerce-blocks/assets/js/editor-components/search-list-control/utils.tsx
@@ -41,7 +41,7 @@ export const defaultMessages = {
export const buildTermsTree = (
filteredList: SearchListItemsType,
list = filteredList
-): SearchListItemType[] | [ ] => {
+): SearchListItemType[] | [] => {
const termsByParent = groupBy( filteredList, 'parent' );
const listById = keyBy( list, 'id' );
const builtParents = [ '0' ];
@@ -90,7 +90,7 @@ export const getFilteredList = (
list: SearchListItemsType,
search: string,
isHierarchical: boolean
-): SearchListItemType[] | [ ] => {
+): SearchListItemType[] | [] => {
if ( ! search ) {
return isHierarchical ? buildTermsTree( list ) : list;
}
diff --git a/plugins/woocommerce-blocks/assets/js/extensions/google-analytics/utils.ts b/plugins/woocommerce-blocks/assets/js/extensions/google-analytics/utils.ts
index f5e43762b60..e4b22a73c19 100644
--- a/plugins/woocommerce-blocks/assets/js/extensions/google-analytics/utils.ts
+++ b/plugins/woocommerce-blocks/assets/js/extensions/google-analytics/utils.ts
@@ -79,40 +79,40 @@ export const trackEvent = (
let currentStep = -1;
-export const trackCheckoutStep = ( step: number ) => ( {
- storeCart,
-}: {
- storeCart: StoreCart;
-} ): void => {
- if ( currentStep === step ) {
- return;
- }
- trackEvent( step === 0 ? 'begin_checkout' : 'checkout_progress', {
- items: storeCart.cartItems.map( getProductFieldObject ),
- coupon: storeCart.cartCoupons[ 0 ]?.code || '',
- currency: storeCart.cartTotals.currency_code,
- value: (
- parseInt( storeCart.cartTotals.total_price, 10 ) /
- 10 ** storeCart.cartTotals.currency_minor_unit
- ).toString(),
- checkout_step: step,
- } );
- currentStep = step;
-};
+export const trackCheckoutStep =
+ ( step: number ) =>
+ ( { storeCart }: { storeCart: StoreCart } ): void => {
+ if ( currentStep === step ) {
+ return;
+ }
+ trackEvent( step === 0 ? 'begin_checkout' : 'checkout_progress', {
+ items: storeCart.cartItems.map( getProductFieldObject ),
+ coupon: storeCart.cartCoupons[ 0 ]?.code || '',
+ currency: storeCart.cartTotals.currency_code,
+ value: (
+ parseInt( storeCart.cartTotals.total_price, 10 ) /
+ 10 ** storeCart.cartTotals.currency_minor_unit
+ ).toString(),
+ checkout_step: step,
+ } );
+ currentStep = step;
+ };
-export const trackCheckoutOption = ( {
- step,
- option,
- value,
-}: {
- step: number;
- option: string;
- value: string;
-} ) => (): void => {
- trackEvent( 'set_checkout_option', {
- checkout_step: step,
- checkout_option: option,
+export const trackCheckoutOption =
+ ( {
+ step,
+ option,
value,
- } );
- currentStep = step;
-};
+ }: {
+ step: number;
+ option: string;
+ value: string;
+ } ) =>
+ (): void => {
+ trackEvent( 'set_checkout_option', {
+ checkout_step: step,
+ checkout_option: option,
+ value,
+ } );
+ currentStep = step;
+ };
diff --git a/plugins/woocommerce-blocks/assets/js/filters/exclude-draft-status-from-analytics.js b/plugins/woocommerce-blocks/assets/js/filters/exclude-draft-status-from-analytics.js
index f935bf8eedb..b97d3e484c9 100644
--- a/plugins/woocommerce-blocks/assets/js/filters/exclude-draft-status-from-analytics.js
+++ b/plugins/woocommerce-blocks/assets/js/filters/exclude-draft-status-from-analytics.js
@@ -19,12 +19,14 @@ addFilter(
return optionsGroup;
};
- const actionableStatusesOptions = settings.woocommerce_actionable_order_statuses.options.map(
- removeCheckoutDraft
- );
- const excludedStatusesOptions = settings.woocommerce_excluded_report_order_statuses.options.map(
- removeCheckoutDraft
- );
+ const actionableStatusesOptions =
+ settings.woocommerce_actionable_order_statuses.options.map(
+ removeCheckoutDraft
+ );
+ const excludedStatusesOptions =
+ settings.woocommerce_excluded_report_order_statuses.options.map(
+ removeCheckoutDraft
+ );
return {
...settings,
diff --git a/plugins/woocommerce-blocks/assets/js/middleware/store-api-nonce.js b/plugins/woocommerce-blocks/assets/js/middleware/store-api-nonce.js
index 2da91f2a8e3..d533d5a3c0a 100644
--- a/plugins/woocommerce-blocks/assets/js/middleware/store-api-nonce.js
+++ b/plugins/woocommerce-blocks/assets/js/middleware/store-api-nonce.js
@@ -103,9 +103,8 @@ const storeNonceMiddleware = ( options, next ) => {
// Add nonce to sub-requests
if ( Array.isArray( options?.data?.requests ) ) {
- options.data.requests = options.data.requests.map(
- appendNonceHeader
- );
+ options.data.requests =
+ options.data.requests.map( appendNonceHeader );
}
}
return next( options, next );
diff --git a/plugins/woocommerce-blocks/assets/js/previews/reviews.js b/plugins/woocommerce-blocks/assets/js/previews/reviews.js
index b2ee378a443..f41c2d4607e 100644
--- a/plugins/woocommerce-blocks/assets/js/previews/reviews.js
+++ b/plugins/woocommerce-blocks/assets/js/previews/reviews.js
@@ -23,8 +23,8 @@ export const previewReviews = [
'woo-gutenberg-products-block'
) }\n`,
reviewer_avatar_urls: {
- '48': blocksConfig.defaultAvatar,
- '96': blocksConfig.defaultAvatar,
+ 48: blocksConfig.defaultAvatar,
+ 96: blocksConfig.defaultAvatar,
},
rating: 5,
verified: true,
@@ -47,8 +47,8 @@ export const previewReviews = [
'woo-gutenberg-products-block'
) }\n`,
reviewer_avatar_urls: {
- '48': blocksConfig.defaultAvatar,
- '96': blocksConfig.defaultAvatar,
+ 48: blocksConfig.defaultAvatar,
+ 96: blocksConfig.defaultAvatar,
},
rating: null,
verified: false,
diff --git a/plugins/woocommerce-blocks/assets/js/shared/hocs/with-filtered-attributes.js b/plugins/woocommerce-blocks/assets/js/shared/hocs/with-filtered-attributes.js
index e3e95488f2e..1a482be565a 100644
--- a/plugins/woocommerce-blocks/assets/js/shared/hocs/with-filtered-attributes.js
+++ b/plugins/woocommerce-blocks/assets/js/shared/hocs/with-filtered-attributes.js
@@ -8,17 +8,19 @@ import { getValidBlockAttributes } from '@woocommerce/base-utils';
*
* @param {Object} blockAttributes Component being wrapped.
*/
-export const withFilteredAttributes = ( blockAttributes ) => (
- OriginalComponent
-) => {
- return ( ownProps ) => {
- const validBlockAttributes = getValidBlockAttributes(
- blockAttributes,
- ownProps
- );
+export const withFilteredAttributes =
+ ( blockAttributes ) => ( OriginalComponent ) => {
+ return ( ownProps ) => {
+ const validBlockAttributes = getValidBlockAttributes(
+ blockAttributes,
+ ownProps
+ );
- return (
-
- );
+ return (
+
+ );
+ };
};
-};
diff --git a/plugins/woocommerce-blocks/bin/hook-docs/actions/index.js b/plugins/woocommerce-blocks/bin/hook-docs/actions/index.js
index 9e3c1ec3d8a..821a168b6d6 100644
--- a/plugins/woocommerce-blocks/bin/hook-docs/actions/index.js
+++ b/plugins/woocommerce-blocks/bin/hook-docs/actions/index.js
@@ -32,8 +32,7 @@ const generate = ( hooks ) => {
const jsonDocs = [
{ html: '' },
{
- html:
- '',
+ html: '',
},
{ h1: 'Actions' },
{ h2: 'Table of Contents' },
diff --git a/plugins/woocommerce-blocks/bin/hook-docs/data/actions.json b/plugins/woocommerce-blocks/bin/hook-docs/data/actions.json
index 3d8481c2f82..8dd7578c4a6 100644
--- a/plugins/woocommerce-blocks/bin/hook-docs/data/actions.json
+++ b/plugins/woocommerce-blocks/bin/hook-docs/data/actions.json
@@ -1,776 +1,718 @@
{
- "$schema": "https://raw.githubusercontent.com/johnbillion/wp-hooks-generator/0.7.3/schema.json",
- "hooks": [
- {
- "name": "woocommerce_add_to_cart",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "action",
- "doc": {
- "description": "Fires when an item is added to the cart.",
- "long_description": "This hook fires when an item is added to the cart. This is triggered from the Store API in this context, but WooCommerce core add to cart events trigger the same hook.",
- "tags": [
- {
- "name": "internal",
- "content": "Matches action name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "ID of the item in the cart.",
- "types": [
- "string"
- ],
- "variable": "$cart_id"
- },
- {
- "name": "param",
- "content": "ID of the product added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$product_id"
- },
- {
- "name": "param",
- "content": "Quantity of the item added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$request_quantity"
- },
- {
- "name": "param",
- "content": "Variation ID of the product added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$variation_id"
- },
- {
- "name": "param",
- "content": "Array of variation data.",
- "types": [
- "array"
- ],
- "variable": "$variation"
- },
- {
- "name": "param",
- "content": "Array of other cart item data.",
- "types": [
- "array"
- ],
- "variable": "$cart_item_data"
- }
- ],
- "long_description_html": "This hook fires when an item is added to the cart. This is triggered from the Store API in this context, but WooCommerce core add to cart events trigger the same hook.
"
- },
- "args": 6
- },
- {
- "name": "woocommerce_after_main_content",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "action",
- "doc": {
- "description": "Hook: woocommerce_after_main_content",
- "long_description": "Called after rendering the main content for a product.",
- "tags": [
- {
- "name": "see",
- "content": "Outputs closing DIV for the content (priority 10)",
- "refers": "woocommerce_output_content_wrapper_end()"
- }
- ],
- "long_description_html": "Called after rendering the main content for a product.
"
- },
- "args": 0
- },
- {
- "name": "woocommerce_after_main_content",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "action",
- "doc": {
- "description": "Hook: woocommerce_after_main_content",
- "long_description": "Called after rendering the main content for a product.",
- "tags": [
- {
- "name": "see",
- "content": "Outputs closing DIV for the content (priority 10)",
- "refers": "woocommerce_output_content_wrapper_end()"
- }
- ],
- "long_description_html": "Called after rendering the main content for a product.
"
- },
- "args": 0
- },
- {
- "name": "woocommerce_after_shop_loop",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "action",
- "doc": {
- "description": "Hook: woocommerce_after_shop_loop.",
- "long_description": "",
- "tags": [
- {
- "name": "see",
- "content": "Renders pagination (priority 10)",
- "refers": "woocommerce_pagination()"
- }
- ],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_applied_coupon",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "action",
- "doc": {
- "description": "Fires after a coupon has been applied to the cart.",
- "long_description": "",
- "tags": [
- {
- "name": "internal",
- "content": "Matches action name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "The coupon code that was applied.",
- "types": [
- "string"
- ],
- "variable": "$coupon_code"
- }
- ],
- "long_description_html": ""
- },
- "args": 1
- },
- {
- "name": "woocommerce_archive_description",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "action",
- "doc": {
- "description": "Hook: woocommerce_archive_description.",
- "long_description": "",
- "tags": [
- {
- "name": "see",
- "content": "Renders the taxonomy archive description (priority 10)",
- "refers": "woocommerce_taxonomy_archive_description()"
- },
- {
- "name": "see",
- "content": "Renders the product archive description (priority 10)",
- "refers": "woocommerce_product_archive_description()"
- }
- ],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_before_main_content",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "action",
- "doc": {
- "description": "Hook: woocommerce_before_main_content",
- "long_description": "Called before rendering the main content for a product.",
- "tags": [
- {
- "name": "see",
- "content": "Outputs opening DIV for the content (priority 10)",
- "refers": "woocommerce_output_content_wrapper()"
- },
- {
- "name": "see",
- "content": "Outputs breadcrumb trail to the current product (priority 20)",
- "refers": "woocommerce_breadcrumb()"
- },
- {
- "name": "see",
- "content": "Outputs schema markup (priority 30)",
- "refers": "WC_Structured_Data::generate_website_data()"
- }
- ],
- "long_description_html": "Called before rendering the main content for a product.
"
- },
- "args": 0
- },
- {
- "name": "woocommerce_before_main_content",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "action",
- "doc": {
- "description": "Hook: woocommerce_before_main_content",
- "long_description": "Called before rendering the main content for a product.",
- "tags": [
- {
- "name": "see",
- "content": "Outputs opening DIV for the content (priority 10)",
- "refers": "woocommerce_output_content_wrapper()"
- },
- {
- "name": "see",
- "content": "Outputs breadcrumb trail to the current product (priority 20)",
- "refers": "woocommerce_breadcrumb()"
- },
- {
- "name": "see",
- "content": "Outputs schema markup (priority 30)",
- "refers": "WC_Structured_Data::generate_website_data()"
- }
- ],
- "long_description_html": "Called before rendering the main content for a product.
"
- },
- "args": 0
- },
- {
- "name": "woocommerce_before_shop_loop",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "action",
- "doc": {
- "description": "Hook: woocommerce_before_shop_loop.",
- "long_description": "",
- "tags": [
- {
- "name": "see",
- "content": "Render error notices (priority 10)",
- "refers": "woocommerce_output_all_notices()"
- },
- {
- "name": "see",
- "content": "Show number of results found (priority 20)",
- "refers": "woocommerce_result_count()"
- },
- {
- "name": "see",
- "content": "Show form to control sort order (priority 30)",
- "refers": "woocommerce_catalog_ordering()"
- }
- ],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_blocks_cart_enqueue_data",
- "file": "BlockTypes/MiniCart.php",
- "type": "action",
- "doc": {
- "description": "Fires after cart block data is registered.",
- "long_description": "",
- "tags": [],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_blocks_cart_enqueue_data",
- "file": "BlockTypes/Cart.php",
- "type": "action",
- "doc": {
- "description": "Fires after cart block data is registered.",
- "long_description": "",
- "tags": [],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_blocks_checkout_enqueue_data",
- "file": "BlockTypes/Checkout.php",
- "type": "action",
- "doc": {
- "description": "Fires after checkout block data is registered.",
- "long_description": "",
- "tags": [],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_blocks_enqueue_cart_block_scripts_after",
- "file": "BlockTypes/Cart.php",
- "type": "action",
- "doc": {
- "description": "Fires after cart block scripts are enqueued.",
- "long_description": "",
- "tags": [],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_blocks_enqueue_cart_block_scripts_before",
- "file": "BlockTypes/Cart.php",
- "type": "action",
- "doc": {
- "description": "Fires before cart block scripts are enqueued.",
- "long_description": "",
- "tags": [],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_blocks_enqueue_checkout_block_scripts_after",
- "file": "BlockTypes/Checkout.php",
- "type": "action",
- "doc": {
- "description": "Fires after checkout block scripts are enqueued.",
- "long_description": "",
- "tags": [],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_blocks_enqueue_checkout_block_scripts_before",
- "file": "BlockTypes/Checkout.php",
- "type": "action",
- "doc": {
- "description": "Fires before checkout block scripts are enqueued.",
- "long_description": "",
- "tags": [],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_blocks_{$this->registry_identifier}_registration",
- "file": "Integrations/IntegrationRegistry.php",
- "type": "action",
- "doc": {
- "description": "Fires when the IntegrationRegistry is initialized.",
- "long_description": "Runs before integrations are initialized allowing new integration to be registered for use. This should be used as the primary hook for integrations to include their scripts, styles, and other code extending the blocks.",
- "tags": [
- {
- "name": "param",
- "content": "Instance of the IntegrationRegistry class which exposes the IntegrationRegistry::register() method.",
- "types": [
- "\\Automattic\\WooCommerce\\Blocks\\Integrations\\IntegrationRegistry"
- ],
- "variable": "$this"
- }
- ],
- "long_description_html": "Runs before integrations are initialized allowing new integration to be registered for use. This should be used as the primary hook for integrations to include their scripts, styles, and other code extending the blocks.
"
- },
- "args": 1
- },
- {
- "name": "woocommerce_check_cart_items",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "action",
- "doc": {
- "description": "Fires when cart items are being validated.",
- "long_description": "Allow 3rd parties to validate cart items. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to wp errors instead.",
- "tags": [
- {
- "name": "deprecated",
- "content": ""
- },
- {
- "name": "internal",
- "content": "Matches action name in WooCommerce core."
- }
- ],
- "long_description_html": "Allow 3rd parties to validate cart items. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to wp errors instead.
"
- },
- "args": 0
- },
- {
- "name": "woocommerce_created_customer",
- "file": "StoreApi/Routes/V1/Checkout.php",
- "type": "action",
- "doc": {
- "description": "Fires after a customer account has been registered.",
- "long_description": "This hook fires after customer accounts are created and passes the customer data.",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "New customer (user) ID.",
- "types": [
- "integer"
- ],
- "variable": "$customer_id"
- },
- {
- "name": "param",
- "content": "Array of customer (user) data.",
- "types": [
- "array"
- ],
- "variable": "$new_customer_data"
- },
- {
- "name": "param",
- "content": "The generated password for the account.",
- "types": [
- "string"
- ],
- "variable": "$password_generated"
- }
- ],
- "long_description_html": "This hook fires after customer accounts are created and passes the customer data.
"
- },
- "args": 3
- },
- {
- "name": "woocommerce_no_products_found",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "action",
- "doc": {
- "description": "Hook: woocommerce_no_products_found.",
- "long_description": "",
- "tags": [
- {
- "name": "see",
- "content": "Default no products found content (priority 10)",
- "refers": "wc_no_products_found()"
- }
- ],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_register_post",
- "file": "StoreApi/Routes/V1/Checkout.php",
- "type": "action",
- "doc": {
- "description": "Fires before a customer account is registered.",
- "long_description": "This hook fires before customer accounts are created and passes the form data (username, email) and an array of errors.\n This could be used to add extra validation logic and append errors to the array.",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Customer username.",
- "types": [
- "string"
- ],
- "variable": "$username"
- },
- {
- "name": "param",
- "content": "Customer email address.",
- "types": [
- "string"
- ],
- "variable": "$user_email"
- },
- {
- "name": "param",
- "content": "Error object.",
- "types": [
- "\\WP_Error"
- ],
- "variable": "$errors"
- }
- ],
- "long_description_html": "This hook fires before customer accounts are created and passes the form data (username, email) and an array of errors.
This could be used to add extra validation logic and append errors to the array.
"
- },
- "args": 3
- },
- {
- "name": "woocommerce_rest_checkout_process_payment_with_context",
- "file": "StoreApi/Routes/V1/Checkout.php",
- "type": "action_reference",
- "doc": {
- "description": "Process payment with context.",
- "long_description": "",
- "tags": [
- {
- "name": "hook",
- "content": "woocommerce_rest_checkout_process_payment_with_context"
- },
- {
- "name": "throws",
- "content": "If there is an error taking payment, an \\Exception object can be thrown with an error message.",
- "types": [
- "\\Exception"
- ]
- },
- {
- "name": "param",
- "content": "Holds context for the payment, including order ID and payment method.",
- "types": [
- "\\Automattic\\WooCommerce\\StoreApi\\Payments\\PaymentContext"
- ],
- "variable": "$context"
- },
- {
- "name": "param",
- "content": "Result object for the transaction.",
- "types": [
- "\\Automattic\\WooCommerce\\StoreApi\\Payments\\PaymentResult"
- ],
- "variable": "$payment_result"
- }
- ],
- "long_description_html": ""
- },
- "args": 1
- },
- {
- "name": "woocommerce_shop_loop",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "action",
- "doc": {
- "description": "Hook: woocommerce_shop_loop.",
- "long_description": "",
- "tags": [],
- "long_description_html": ""
- },
- "args": 0
- },
- {
- "name": "woocommerce_store_api_cart_errors",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "action",
- "doc": {
- "description": "Fires an action to validate the cart.",
- "long_description": "Functions hooking into this should add custom errors using the provided WP_Error instance.",
- "tags": [
- {
- "name": "example",
- "content": "docs/examples/validate-cart.md"
- },
- {
- "name": "param",
- "content": "WP_Error object.",
- "types": [
- "\\WP_Error"
- ],
- "variable": "$errors"
- },
- {
- "name": "param",
- "content": "Cart object.",
- "types": [
- "\\WC_Cart"
- ],
- "variable": "$cart"
- }
- ],
- "long_description_html": "Functions hooking into this should add custom errors using the provided WP_Error instance.
"
- },
- "args": 2
- },
- {
- "name": "woocommerce_store_api_cart_update_customer_from_request",
- "file": "StoreApi/Routes/V1/CartUpdateCustomer.php",
- "type": "action",
- "doc": {
- "description": "Fires when the Checkout Block/Store API updates a customer from the API request data.",
- "long_description": "",
- "tags": [
- {
- "name": "param",
- "content": "Customer object.",
- "types": [
- "\\WC_Customer"
- ],
- "variable": "$customer"
- },
- {
- "name": "param",
- "content": "Full details about the request.",
- "types": [
- "\\WP_REST_Request"
- ],
- "variable": "$request"
- }
- ],
- "long_description_html": ""
- },
- "args": 2
- },
- {
- "name": "woocommerce_store_api_cart_update_order_from_request",
- "file": "StoreApi/Routes/V1/AbstractCartRoute.php",
- "type": "action",
- "doc": {
- "description": "Fires when the order is synced with cart data from a cart route.",
- "long_description": "",
- "tags": [
- {
- "name": "param",
- "content": "Order object.",
- "types": [
- "\\WC_Order"
- ],
- "variable": "$draft_order"
- },
- {
- "name": "param",
- "content": "Customer object.",
- "types": [
- "\\WC_Customer"
- ],
- "variable": "$customer"
- },
- {
- "name": "param",
- "content": "Full details about the request.",
- "types": [
- "\\WP_REST_Request"
- ],
- "variable": "$request"
- }
- ],
- "long_description_html": ""
- },
- "args": 2
- },
- {
- "name": "woocommerce_store_api_checkout_order_processed",
- "file": "StoreApi/Routes/V1/Checkout.php",
- "type": "action",
- "doc": {
- "description": "Fires before an order is processed by the Checkout Block/Store API.",
- "long_description": "This hook informs extensions that $order has completed processing and is ready for payment.\n This is similar to existing core hook woocommerce_checkout_order_processed. We're using a new action: - To keep the interface focused (only pass $order, not passing request data). - This also explicitly indicates these orders are from checkout block/StoreAPI.",
- "tags": [
- {
- "name": "see",
- "content": "",
- "refers": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3238"
- },
- {
- "name": "example",
- "content": "docs/examples/checkout-order-processed.md"
- },
- {
- "name": "param",
- "content": "Order object.",
- "types": [
- "\\WC_Order"
- ],
- "variable": "$order"
- }
- ],
- "long_description_html": "This hook informs extensions that $order has completed processing and is ready for payment.
This is similar to existing core hook woocommerce_checkout_order_processed. We're using a new action:
To keep the interface focused (only pass $order, not passing request data). This also explicitly indicates these orders are from checkout block/StoreAPI. "
- },
- "args": 1
- },
- {
- "name": "woocommerce_store_api_checkout_update_order_from_request",
- "file": "StoreApi/Routes/V1/Checkout.php",
- "type": "action",
- "doc": {
- "description": "Fires when the Checkout Block/Store API updates an order's from the API request data.",
- "long_description": "This hook gives extensions the chance to update orders based on the data in the request. This can be used in conjunction with the ExtendSchema class to post custom data and then process it.",
- "tags": [
- {
- "name": "param",
- "content": "Order object.",
- "types": [
- "\\WC_Order"
- ],
- "variable": "$order"
- },
- {
- "name": "param",
- "content": "Full details about the request.",
- "types": [
- "\\WP_REST_Request"
- ],
- "variable": "$request"
- }
- ],
- "long_description_html": "This hook gives extensions the chance to update orders based on the data in the request. This can be used in conjunction with the ExtendSchema class to post custom data and then process it.
"
- },
- "args": 2
- },
- {
- "name": "woocommerce_store_api_checkout_update_order_meta",
- "file": "StoreApi/Routes/V1/Checkout.php",
- "type": "action",
- "doc": {
- "description": "Fires when the Checkout Block/Store API updates an order's meta data.",
- "long_description": "This hook gives extensions the chance to add or update meta data on the $order. Throwing an exception from a callback attached to this action will make the Checkout Block render in a warning state, effectively preventing checkout.\n This is similar to existing core hook woocommerce_checkout_update_order_meta. We're using a new action: - To keep the interface focused (only pass $order, not passing request data). - This also explicitly indicates these orders are from checkout block/StoreAPI.",
- "tags": [
- {
- "name": "see",
- "content": "",
- "refers": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3686"
- },
- {
- "name": "param",
- "content": "Order object.",
- "types": [
- "\\WC_Order"
- ],
- "variable": "$order"
- }
- ],
- "long_description_html": "This hook gives extensions the chance to add or update meta data on the $order. Throwing an exception from a callback attached to this action will make the Checkout Block render in a warning state, effectively preventing checkout.
This is similar to existing core hook woocommerce_checkout_update_order_meta. We're using a new action:
To keep the interface focused (only pass $order, not passing request data). This also explicitly indicates these orders are from checkout block/StoreAPI. "
- },
- "args": 1
- },
- {
- "name": "woocommerce_store_api_validate_add_to_cart",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "action",
- "doc": {
- "description": "Fires during validation when adding an item to the cart via the Store API.",
- "long_description": "Fire action to validate add to cart. Functions hooking into this should throw an \\Exception to prevent add to cart from happening.",
- "tags": [
- {
- "name": "param",
- "content": "Product object being added to the cart.",
- "types": [
- "\\WC_Product"
- ],
- "variable": "$product"
- },
- {
- "name": "param",
- "content": "Add to cart request params including id, quantity, and variation attributes.",
- "types": [
- "array"
- ],
- "variable": "$request"
- }
- ],
- "long_description_html": "Fire action to validate add to cart. Functions hooking into this should throw an \\Exception to prevent add to cart from happening.
"
- },
- "args": 2
- },
- {
- "name": "woocommerce_store_api_validate_cart_item",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "action",
- "doc": {
- "description": "Fire action to validate add to cart. Functions hooking into this should throw an \\Exception to prevent add to cart from occurring.",
- "long_description": "",
- "tags": [
- {
- "name": "param",
- "content": "Product object being added to the cart.",
- "types": [
- "\\WC_Product"
- ],
- "variable": "$product"
- },
- {
- "name": "param",
- "content": "Cart item array.",
- "types": [
- "array"
- ],
- "variable": "$cart_item"
- }
- ],
- "long_description_html": ""
- },
- "args": 2
- }
- ]
-}
\ No newline at end of file
+ "$schema": "https://raw.githubusercontent.com/johnbillion/wp-hooks-generator/0.7.3/schema.json",
+ "hooks": [
+ {
+ "name": "woocommerce_add_to_cart",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires when an item is added to the cart.",
+ "long_description": "This hook fires when an item is added to the cart. This is triggered from the Store API in this context, but WooCommerce core add to cart events trigger the same hook.",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches action name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "ID of the item in the cart.",
+ "types": [ "string" ],
+ "variable": "$cart_id"
+ },
+ {
+ "name": "param",
+ "content": "ID of the product added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$product_id"
+ },
+ {
+ "name": "param",
+ "content": "Quantity of the item added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$request_quantity"
+ },
+ {
+ "name": "param",
+ "content": "Variation ID of the product added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$variation_id"
+ },
+ {
+ "name": "param",
+ "content": "Array of variation data.",
+ "types": [ "array" ],
+ "variable": "$variation"
+ },
+ {
+ "name": "param",
+ "content": "Array of other cart item data.",
+ "types": [ "array" ],
+ "variable": "$cart_item_data"
+ }
+ ],
+ "long_description_html": "This hook fires when an item is added to the cart. This is triggered from the Store API in this context, but WooCommerce core add to cart events trigger the same hook.
"
+ },
+ "args": 6
+ },
+ {
+ "name": "woocommerce_after_main_content",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "action",
+ "doc": {
+ "description": "Hook: woocommerce_after_main_content",
+ "long_description": "Called after rendering the main content for a product.",
+ "tags": [
+ {
+ "name": "see",
+ "content": "Outputs closing DIV for the content (priority 10)",
+ "refers": "woocommerce_output_content_wrapper_end()"
+ }
+ ],
+ "long_description_html": "Called after rendering the main content for a product.
"
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_after_main_content",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "action",
+ "doc": {
+ "description": "Hook: woocommerce_after_main_content",
+ "long_description": "Called after rendering the main content for a product.",
+ "tags": [
+ {
+ "name": "see",
+ "content": "Outputs closing DIV for the content (priority 10)",
+ "refers": "woocommerce_output_content_wrapper_end()"
+ }
+ ],
+ "long_description_html": "Called after rendering the main content for a product.
"
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_after_shop_loop",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "action",
+ "doc": {
+ "description": "Hook: woocommerce_after_shop_loop.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "see",
+ "content": "Renders pagination (priority 10)",
+ "refers": "woocommerce_pagination()"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_applied_coupon",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires after a coupon has been applied to the cart.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches action name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "The coupon code that was applied.",
+ "types": [ "string" ],
+ "variable": "$coupon_code"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_archive_description",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "action",
+ "doc": {
+ "description": "Hook: woocommerce_archive_description.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "see",
+ "content": "Renders the taxonomy archive description (priority 10)",
+ "refers": "woocommerce_taxonomy_archive_description()"
+ },
+ {
+ "name": "see",
+ "content": "Renders the product archive description (priority 10)",
+ "refers": "woocommerce_product_archive_description()"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_before_main_content",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "action",
+ "doc": {
+ "description": "Hook: woocommerce_before_main_content",
+ "long_description": "Called before rendering the main content for a product.",
+ "tags": [
+ {
+ "name": "see",
+ "content": "Outputs opening DIV for the content (priority 10)",
+ "refers": "woocommerce_output_content_wrapper()"
+ },
+ {
+ "name": "see",
+ "content": "Outputs breadcrumb trail to the current product (priority 20)",
+ "refers": "woocommerce_breadcrumb()"
+ },
+ {
+ "name": "see",
+ "content": "Outputs schema markup (priority 30)",
+ "refers": "WC_Structured_Data::generate_website_data()"
+ }
+ ],
+ "long_description_html": "Called before rendering the main content for a product.
"
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_before_main_content",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "action",
+ "doc": {
+ "description": "Hook: woocommerce_before_main_content",
+ "long_description": "Called before rendering the main content for a product.",
+ "tags": [
+ {
+ "name": "see",
+ "content": "Outputs opening DIV for the content (priority 10)",
+ "refers": "woocommerce_output_content_wrapper()"
+ },
+ {
+ "name": "see",
+ "content": "Outputs breadcrumb trail to the current product (priority 20)",
+ "refers": "woocommerce_breadcrumb()"
+ },
+ {
+ "name": "see",
+ "content": "Outputs schema markup (priority 30)",
+ "refers": "WC_Structured_Data::generate_website_data()"
+ }
+ ],
+ "long_description_html": "Called before rendering the main content for a product.
"
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_before_shop_loop",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "action",
+ "doc": {
+ "description": "Hook: woocommerce_before_shop_loop.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "see",
+ "content": "Render error notices (priority 10)",
+ "refers": "woocommerce_output_all_notices()"
+ },
+ {
+ "name": "see",
+ "content": "Show number of results found (priority 20)",
+ "refers": "woocommerce_result_count()"
+ },
+ {
+ "name": "see",
+ "content": "Show form to control sort order (priority 30)",
+ "refers": "woocommerce_catalog_ordering()"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_blocks_cart_enqueue_data",
+ "file": "BlockTypes/MiniCart.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires after cart block data is registered.",
+ "long_description": "",
+ "tags": [],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_blocks_cart_enqueue_data",
+ "file": "BlockTypes/Cart.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires after cart block data is registered.",
+ "long_description": "",
+ "tags": [],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_blocks_checkout_enqueue_data",
+ "file": "BlockTypes/Checkout.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires after checkout block data is registered.",
+ "long_description": "",
+ "tags": [],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_blocks_enqueue_cart_block_scripts_after",
+ "file": "BlockTypes/Cart.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires after cart block scripts are enqueued.",
+ "long_description": "",
+ "tags": [],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_blocks_enqueue_cart_block_scripts_before",
+ "file": "BlockTypes/Cart.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires before cart block scripts are enqueued.",
+ "long_description": "",
+ "tags": [],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_blocks_enqueue_checkout_block_scripts_after",
+ "file": "BlockTypes/Checkout.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires after checkout block scripts are enqueued.",
+ "long_description": "",
+ "tags": [],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_blocks_enqueue_checkout_block_scripts_before",
+ "file": "BlockTypes/Checkout.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires before checkout block scripts are enqueued.",
+ "long_description": "",
+ "tags": [],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_blocks_{$this->registry_identifier}_registration",
+ "file": "Integrations/IntegrationRegistry.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires when the IntegrationRegistry is initialized.",
+ "long_description": "Runs before integrations are initialized allowing new integration to be registered for use. This should be used as the primary hook for integrations to include their scripts, styles, and other code extending the blocks.",
+ "tags": [
+ {
+ "name": "param",
+ "content": "Instance of the IntegrationRegistry class which exposes the IntegrationRegistry::register() method.",
+ "types": [
+ "\\Automattic\\WooCommerce\\Blocks\\Integrations\\IntegrationRegistry"
+ ],
+ "variable": "$this"
+ }
+ ],
+ "long_description_html": "Runs before integrations are initialized allowing new integration to be registered for use. This should be used as the primary hook for integrations to include their scripts, styles, and other code extending the blocks.
"
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_check_cart_items",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires when cart items are being validated.",
+ "long_description": "Allow 3rd parties to validate cart items. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to wp errors instead.",
+ "tags": [
+ {
+ "name": "deprecated",
+ "content": ""
+ },
+ {
+ "name": "internal",
+ "content": "Matches action name in WooCommerce core."
+ }
+ ],
+ "long_description_html": "Allow 3rd parties to validate cart items. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to wp errors instead.
"
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_created_customer",
+ "file": "StoreApi/Routes/V1/Checkout.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires after a customer account has been registered.",
+ "long_description": "This hook fires after customer accounts are created and passes the customer data.",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "New customer (user) ID.",
+ "types": [ "integer" ],
+ "variable": "$customer_id"
+ },
+ {
+ "name": "param",
+ "content": "Array of customer (user) data.",
+ "types": [ "array" ],
+ "variable": "$new_customer_data"
+ },
+ {
+ "name": "param",
+ "content": "The generated password for the account.",
+ "types": [ "string" ],
+ "variable": "$password_generated"
+ }
+ ],
+ "long_description_html": "This hook fires after customer accounts are created and passes the customer data.
"
+ },
+ "args": 3
+ },
+ {
+ "name": "woocommerce_no_products_found",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "action",
+ "doc": {
+ "description": "Hook: woocommerce_no_products_found.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "see",
+ "content": "Default no products found content (priority 10)",
+ "refers": "wc_no_products_found()"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_register_post",
+ "file": "StoreApi/Routes/V1/Checkout.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires before a customer account is registered.",
+ "long_description": "This hook fires before customer accounts are created and passes the form data (username, email) and an array of errors.\n This could be used to add extra validation logic and append errors to the array.",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Customer username.",
+ "types": [ "string" ],
+ "variable": "$username"
+ },
+ {
+ "name": "param",
+ "content": "Customer email address.",
+ "types": [ "string" ],
+ "variable": "$user_email"
+ },
+ {
+ "name": "param",
+ "content": "Error object.",
+ "types": [ "\\WP_Error" ],
+ "variable": "$errors"
+ }
+ ],
+ "long_description_html": "This hook fires before customer accounts are created and passes the form data (username, email) and an array of errors.
This could be used to add extra validation logic and append errors to the array.
"
+ },
+ "args": 3
+ },
+ {
+ "name": "woocommerce_rest_checkout_process_payment_with_context",
+ "file": "StoreApi/Routes/V1/Checkout.php",
+ "type": "action_reference",
+ "doc": {
+ "description": "Process payment with context.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "hook",
+ "content": "woocommerce_rest_checkout_process_payment_with_context"
+ },
+ {
+ "name": "throws",
+ "content": "If there is an error taking payment, an \\Exception object can be thrown with an error message.",
+ "types": [ "\\Exception" ]
+ },
+ {
+ "name": "param",
+ "content": "Holds context for the payment, including order ID and payment method.",
+ "types": [
+ "\\Automattic\\WooCommerce\\StoreApi\\Payments\\PaymentContext"
+ ],
+ "variable": "$context"
+ },
+ {
+ "name": "param",
+ "content": "Result object for the transaction.",
+ "types": [
+ "\\Automattic\\WooCommerce\\StoreApi\\Payments\\PaymentResult"
+ ],
+ "variable": "$payment_result"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_shop_loop",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "action",
+ "doc": {
+ "description": "Hook: woocommerce_shop_loop.",
+ "long_description": "",
+ "tags": [],
+ "long_description_html": ""
+ },
+ "args": 0
+ },
+ {
+ "name": "woocommerce_store_api_cart_errors",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires an action to validate the cart.",
+ "long_description": "Functions hooking into this should add custom errors using the provided WP_Error instance.",
+ "tags": [
+ {
+ "name": "example",
+ "content": "docs/examples/validate-cart.md"
+ },
+ {
+ "name": "param",
+ "content": "WP_Error object.",
+ "types": [ "\\WP_Error" ],
+ "variable": "$errors"
+ },
+ {
+ "name": "param",
+ "content": "Cart object.",
+ "types": [ "\\WC_Cart" ],
+ "variable": "$cart"
+ }
+ ],
+ "long_description_html": "Functions hooking into this should add custom errors using the provided WP_Error instance.
"
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_store_api_cart_update_customer_from_request",
+ "file": "StoreApi/Routes/V1/CartUpdateCustomer.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires when the Checkout Block/Store API updates a customer from the API request data.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "param",
+ "content": "Customer object.",
+ "types": [ "\\WC_Customer" ],
+ "variable": "$customer"
+ },
+ {
+ "name": "param",
+ "content": "Full details about the request.",
+ "types": [ "\\WP_REST_Request" ],
+ "variable": "$request"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_store_api_cart_update_order_from_request",
+ "file": "StoreApi/Routes/V1/AbstractCartRoute.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires when the order is synced with cart data from a cart route.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "param",
+ "content": "Order object.",
+ "types": [ "\\WC_Order" ],
+ "variable": "$draft_order"
+ },
+ {
+ "name": "param",
+ "content": "Customer object.",
+ "types": [ "\\WC_Customer" ],
+ "variable": "$customer"
+ },
+ {
+ "name": "param",
+ "content": "Full details about the request.",
+ "types": [ "\\WP_REST_Request" ],
+ "variable": "$request"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_store_api_checkout_order_processed",
+ "file": "StoreApi/Routes/V1/Checkout.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires before an order is processed by the Checkout Block/Store API.",
+ "long_description": "This hook informs extensions that $order has completed processing and is ready for payment.\n This is similar to existing core hook woocommerce_checkout_order_processed. We're using a new action: - To keep the interface focused (only pass $order, not passing request data). - This also explicitly indicates these orders are from checkout block/StoreAPI.",
+ "tags": [
+ {
+ "name": "see",
+ "content": "",
+ "refers": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3238"
+ },
+ {
+ "name": "example",
+ "content": "docs/examples/checkout-order-processed.md"
+ },
+ {
+ "name": "param",
+ "content": "Order object.",
+ "types": [ "\\WC_Order" ],
+ "variable": "$order"
+ }
+ ],
+ "long_description_html": "This hook informs extensions that $order has completed processing and is ready for payment.
This is similar to existing core hook woocommerce_checkout_order_processed. We're using a new action:
To keep the interface focused (only pass $order, not passing request data). This also explicitly indicates these orders are from checkout block/StoreAPI. "
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_store_api_checkout_update_order_from_request",
+ "file": "StoreApi/Routes/V1/Checkout.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires when the Checkout Block/Store API updates an order's from the API request data.",
+ "long_description": "This hook gives extensions the chance to update orders based on the data in the request. This can be used in conjunction with the ExtendSchema class to post custom data and then process it.",
+ "tags": [
+ {
+ "name": "param",
+ "content": "Order object.",
+ "types": [ "\\WC_Order" ],
+ "variable": "$order"
+ },
+ {
+ "name": "param",
+ "content": "Full details about the request.",
+ "types": [ "\\WP_REST_Request" ],
+ "variable": "$request"
+ }
+ ],
+ "long_description_html": "This hook gives extensions the chance to update orders based on the data in the request. This can be used in conjunction with the ExtendSchema class to post custom data and then process it.
"
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_store_api_checkout_update_order_meta",
+ "file": "StoreApi/Routes/V1/Checkout.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires when the Checkout Block/Store API updates an order's meta data.",
+ "long_description": "This hook gives extensions the chance to add or update meta data on the $order. Throwing an exception from a callback attached to this action will make the Checkout Block render in a warning state, effectively preventing checkout.\n This is similar to existing core hook woocommerce_checkout_update_order_meta. We're using a new action: - To keep the interface focused (only pass $order, not passing request data). - This also explicitly indicates these orders are from checkout block/StoreAPI.",
+ "tags": [
+ {
+ "name": "see",
+ "content": "",
+ "refers": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/3686"
+ },
+ {
+ "name": "param",
+ "content": "Order object.",
+ "types": [ "\\WC_Order" ],
+ "variable": "$order"
+ }
+ ],
+ "long_description_html": "This hook gives extensions the chance to add or update meta data on the $order. Throwing an exception from a callback attached to this action will make the Checkout Block render in a warning state, effectively preventing checkout.
This is similar to existing core hook woocommerce_checkout_update_order_meta. We're using a new action:
To keep the interface focused (only pass $order, not passing request data). This also explicitly indicates these orders are from checkout block/StoreAPI. "
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_store_api_validate_add_to_cart",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "action",
+ "doc": {
+ "description": "Fires during validation when adding an item to the cart via the Store API.",
+ "long_description": "Fire action to validate add to cart. Functions hooking into this should throw an \\Exception to prevent add to cart from happening.",
+ "tags": [
+ {
+ "name": "param",
+ "content": "Product object being added to the cart.",
+ "types": [ "\\WC_Product" ],
+ "variable": "$product"
+ },
+ {
+ "name": "param",
+ "content": "Add to cart request params including id, quantity, and variation attributes.",
+ "types": [ "array" ],
+ "variable": "$request"
+ }
+ ],
+ "long_description_html": "Fire action to validate add to cart. Functions hooking into this should throw an \\Exception to prevent add to cart from happening.
"
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_store_api_validate_cart_item",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "action",
+ "doc": {
+ "description": "Fire action to validate add to cart. Functions hooking into this should throw an \\Exception to prevent add to cart from occurring.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "param",
+ "content": "Product object being added to the cart.",
+ "types": [ "\\WC_Product" ],
+ "variable": "$product"
+ },
+ {
+ "name": "param",
+ "content": "Cart item array.",
+ "types": [ "array" ],
+ "variable": "$cart_item"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 2
+ }
+ ]
+}
diff --git a/plugins/woocommerce-blocks/bin/hook-docs/data/filters.json b/plugins/woocommerce-blocks/bin/hook-docs/data/filters.json
index d1d57008517..e2efdd482aa 100644
--- a/plugins/woocommerce-blocks/bin/hook-docs/data/filters.json
+++ b/plugins/woocommerce-blocks/bin/hook-docs/data/filters.json
@@ -1,1011 +1,854 @@
{
- "$schema": "https://raw.githubusercontent.com/johnbillion/wp-hooks-generator/0.7.3/schema.json",
- "hooks": [
- {
- "name": "__experimental_woocommerce_blocks_add_data_attributes_to_block",
- "file": "BlockTypesController.php",
- "type": "filter",
- "doc": {
- "description": "Filters the list of allowed Block Names",
- "long_description": "This hook defines which block names should have block name and attribute data- attributes appended on render.",
- "tags": [
- {
- "name": "param",
- "content": "List of namespaces.",
- "types": [
- "array"
- ],
- "variable": "$allowed_namespaces"
- }
- ],
- "long_description_html": "This hook defines which block names should have block name and attribute data- attributes appended on render.
"
- },
- "args": 1
- },
- {
- "name": "__experimental_woocommerce_blocks_add_data_attributes_to_namespace",
- "file": "BlockTypesController.php",
- "type": "filter",
- "doc": {
- "description": "Filters the list of allowed block namespaces.",
- "long_description": "This hook defines which block namespaces should have block name and attribute `data-` attributes appended on render.",
- "tags": [
- {
- "name": "param",
- "content": "List of namespaces.",
- "types": [
- "array"
- ],
- "variable": "$allowed_namespaces"
- }
- ],
- "long_description_html": "This hook defines which block namespaces should have block name and attribute data-
attributes appended on render.
"
- },
- "args": 1
- },
- {
- "name": "__experimental_woocommerce_blocks_payment_gateway_features_list",
- "file": "Payments/Integrations/PayPal.php",
- "type": "filter",
- "doc": {
- "description": "Filter to control what features are available for each payment gateway.",
- "long_description": "",
- "tags": [
- {
- "name": "example",
- "content": "docs/examples/payment-gateways-features-list.md"
- },
- {
- "name": "param",
- "content": "List of supported features.",
- "types": [
- "array"
- ],
- "variable": "$features"
- },
- {
- "name": "param",
- "content": "Gateway name.",
- "types": [
- "string"
- ],
- "variable": "$name"
- },
- {
- "name": "return",
- "content": "Updated list of supported features.",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 2
- },
- {
- "name": "woocommerce_add_cart_item",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "filter",
- "doc": {
- "description": "Filters the item being added to the cart.",
- "long_description": "",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Array of cart item data being added to the cart.",
- "types": [
- "array"
- ],
- "variable": "$cart_item_data"
- },
- {
- "name": "param",
- "content": "Id of the item in the cart.",
- "types": [
- "string"
- ],
- "variable": "$cart_id"
- },
- {
- "name": "return",
- "content": "Updated cart item data.",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 2
- },
- {
- "name": "woocommerce_add_cart_item_data",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "filter",
- "doc": {
- "description": "Filter cart item data for add to cart requests.",
- "long_description": "",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Array of other cart item data.",
- "types": [
- "array"
- ],
- "variable": "$cart_item_data"
- },
- {
- "name": "param",
- "content": "ID of the product added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$product_id"
- },
- {
- "name": "param",
- "content": "Variation ID of the product added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$variation_id"
- },
- {
- "name": "param",
- "content": "Quantity of the item added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$quantity"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 4
- },
- {
- "name": "woocommerce_add_to_cart_sold_individually_quantity",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "filter",
- "doc": {
- "description": "Filter sold individually quantity for add to cart requests.",
- "long_description": "",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Defaults to 1.",
- "types": [
- "integer"
- ],
- "variable": "$sold_individually_quantity"
- },
- {
- "name": "param",
- "content": "Quantity of the item added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$quantity"
- },
- {
- "name": "param",
- "content": "ID of the product added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$product_id"
- },
- {
- "name": "param",
- "content": "Variation ID of the product added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$variation_id"
- },
- {
- "name": "param",
- "content": "Array of other cart item data.",
- "types": [
- "array"
- ],
- "variable": "$cart_item_data"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "integer"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 5
- },
- {
- "name": "woocommerce_add_to_cart_validation",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "filter",
- "doc": {
- "description": "Filters if an item being added to the cart passed validation checks.",
- "long_description": "Allow 3rd parties to validate if an item can be added to the cart. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to exceptions instead.",
- "tags": [
- {
- "name": "deprecated",
- "content": ""
- },
- {
- "name": "param",
- "content": "True if the item passed validation.",
- "types": [
- "boolean"
- ],
- "variable": "$passed_validation"
- },
- {
- "name": "param",
- "content": "Product ID being validated.",
- "types": [
- "integer"
- ],
- "variable": "$product_id"
- },
- {
- "name": "param",
- "content": "Quantity added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$quantity"
- },
- {
- "name": "param",
- "content": "Variation ID being added to the cart.",
- "types": [
- "integer"
- ],
- "variable": "$variation_id"
- },
- {
- "name": "param",
- "content": "Variation data.",
- "types": [
- "array"
- ],
- "variable": "$variation"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "boolean"
- ]
- }
- ],
- "long_description_html": "Allow 3rd parties to validate if an item can be added to the cart. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to exceptions instead.
"
- },
- "args": 5
- },
- {
- "name": "woocommerce_adjust_non_base_location_prices",
- "file": "StoreApi/Utilities/ProductQuery.php",
- "type": "filter",
- "doc": {
- "description": "Filters if taxes should be removed from locations outside the store base location.",
- "long_description": "The woocommerce_adjust_non_base_location_prices filter can stop base taxes being taken off when dealing with out of base locations. e.g. If a product costs 10 including tax, all users will pay 10 regardless of location and taxes.",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "True by default.",
- "types": [
- "boolean"
- ],
- "variable": "$adjust_non_base_location_prices"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "boolean"
- ]
- }
- ],
- "long_description_html": "The woocommerce_adjust_non_base_location_prices filter can stop base taxes being taken off when dealing with out of base locations. e.g. If a product costs 10 including tax, all users will pay 10 regardless of location and taxes.
"
- },
- "args": 1
- },
- {
- "name": "woocommerce_admin_disabled",
- "file": "InboxNotifications.php",
- "type": "filter",
- "doc": {
- "description": "",
- "long_description": "",
- "tags": [],
- "long_description_html": ""
- },
- "args": 1
- },
- {
- "name": "woocommerce_apply_individual_use_coupon",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "filter",
- "doc": {
- "description": "Filter coupons to remove when applying an individual use coupon.",
- "long_description": "",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Array of coupons to remove from the cart.",
- "types": [
- "array"
- ],
- "variable": "$coupons"
- },
- {
- "name": "param",
- "content": "Coupon object applied to the cart.",
- "types": [
- "\\WC_Coupon"
- ],
- "variable": "$coupon"
- },
- {
- "name": "param",
- "content": "Array of applied coupons already applied to the cart.",
- "types": [
- "array"
- ],
- "variable": "$applied_coupons"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 3
- },
- {
- "name": "woocommerce_apply_with_individual_use_coupon",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "filter",
- "doc": {
- "description": "Filters if a coupon can be applied alongside other individual use coupons.",
- "long_description": "",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Defaults to false.",
- "types": [
- "boolean"
- ],
- "variable": "$apply_with_individual_use_coupon"
- },
- {
- "name": "param",
- "content": "Coupon object applied to the cart.",
- "types": [
- "\\WC_Coupon"
- ],
- "variable": "$coupon"
- },
- {
- "name": "param",
- "content": "Individual use coupon already applied to the cart.",
- "types": [
- "\\WC_Coupon"
- ],
- "variable": "$individual_use_coupon"
- },
- {
- "name": "param",
- "content": "Array of applied coupons already applied to the cart.",
- "types": [
- "array"
- ],
- "variable": "$applied_coupons"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "boolean"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 4
- },
- {
- "name": "woocommerce_blocks_product_grid_is_cacheable",
- "file": "BlockTypes/AbstractProductGrid.php",
- "type": "filter",
- "doc": {
- "description": "Filters whether or not the product grid is cacheable.",
- "long_description": "",
- "tags": [
- {
- "name": "param",
- "content": "The list of script dependencies.",
- "types": [
- "boolean"
- ],
- "variable": "$is_cacheable"
- },
- {
- "name": "param",
- "content": "Query args for the products query passed to BlocksWpQuery.",
- "types": [
- "array"
- ],
- "variable": "$query_args"
- },
- {
- "name": "return",
- "content": "True to enable cache, false to disable cache.",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 2
- },
- {
- "name": "woocommerce_blocks_product_grid_item_html",
- "file": "BlockTypes/AbstractProductGrid.php",
- "type": "filter",
- "doc": {
- "description": "Filters the HTML for products in the grid.",
- "long_description": "",
- "tags": [
- {
- "name": "param",
- "content": "Product grid item HTML.",
- "types": [
- "string"
- ],
- "variable": "$html"
- },
- {
- "name": "param",
- "content": "Product data passed to the template.",
- "types": [
- "array"
- ],
- "variable": "$data"
- },
- {
- "name": "param",
- "content": "Product object.",
- "types": [
- "\\WC_Product"
- ],
- "variable": "$product"
- },
- {
- "name": "return",
- "content": "Updated product grid item HTML.",
- "types": [
- "string"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 3
- },
- {
- "name": "woocommerce_blocks_register_script_dependencies",
- "file": "Assets/Api.php",
- "type": "filter",
- "doc": {
- "description": "Filters the list of script dependencies.",
- "long_description": "",
- "tags": [
- {
- "name": "param",
- "content": "The list of script dependencies.",
- "types": [
- "array"
- ],
- "variable": "$dependencies"
- },
- {
- "name": "param",
- "content": "The script's handle.",
- "types": [
- "string"
- ],
- "variable": "$handle"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 2
- },
- {
- "name": "woocommerce_cart_contents_changed",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "filter",
- "doc": {
- "description": "Filters the entire cart contents when the cart changes.",
- "long_description": "",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Array of all cart items.",
- "types": [
- "array"
- ],
- "variable": "$cart_contents"
- },
- {
- "name": "return",
- "content": "Updated array of all cart items.",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 1
- },
- {
- "name": "woocommerce_ga_disable_tracking",
- "file": "Domain/Services/GoogleAnalytics.php",
- "type": "filter",
- "doc": {
- "description": "Filter to disable Google Analytics tracking.",
- "long_description": "",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in GA extension."
- },
- {
- "name": "param",
- "content": "If true, tracking will be disabled.",
- "types": [
- "boolean"
- ],
- "variable": "$disable_tracking"
- }
- ],
- "long_description_html": ""
- },
- "args": 1
- },
- {
- "name": "woocommerce_get_item_data",
- "file": "StoreApi/Schemas/V1/CartItemSchema.php",
- "type": "filter",
- "doc": {
- "description": "Filters cart item data.",
- "long_description": "Filters the variation option name for custom option slugs.",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Cart item data. Empty by default.",
- "types": [
- "array"
- ],
- "variable": "$item_data"
- },
- {
- "name": "param",
- "content": "Cart item array.",
- "types": [
- "array"
- ],
- "variable": "$cart_item"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": "Filters the variation option name for custom option slugs.
"
- },
- "args": 2
- },
- {
- "name": "woocommerce_new_customer_data",
- "file": "StoreApi/Routes/V1/Checkout.php",
- "type": "filter",
- "doc": {
- "description": "Filters customer data before a customer account is registered.",
- "long_description": "This hook filters customer data. It allows user data to be changed, for example, username, password, email, first name, last name, and role.",
- "tags": [
- {
- "name": "param",
- "content": "An array of customer (user) data.",
- "types": [
- "array"
- ],
- "variable": "$customer_data"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": "This hook filters customer data. It allows user data to be changed, for example, username, password, email, first name, last name, and role.
"
- },
- "args": 1
- },
- {
- "name": "woocommerce_registration_errors",
- "file": "StoreApi/Routes/V1/Checkout.php",
- "type": "filter",
- "doc": {
- "description": "Filters registration errors before a customer account is registered.",
- "long_description": "This hook filters registration errors. This can be used to manipulate the array of errors before they are displayed.",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Error object.",
- "types": [
- "\\WP_Error"
- ],
- "variable": "$errors"
- },
- {
- "name": "param",
- "content": "Customer username.",
- "types": [
- "string"
- ],
- "variable": "$username"
- },
- {
- "name": "param",
- "content": "Customer email address.",
- "types": [
- "string"
- ],
- "variable": "$user_email"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "\\WP_Error"
- ]
- }
- ],
- "long_description_html": "This hook filters registration errors. This can be used to manipulate the array of errors before they are displayed.
"
- },
- "args": 3
- },
- {
- "name": "woocommerce_shared_settings",
- "file": "Assets/AssetDataRegistry.php",
- "type": "filter",
- "doc": {
- "description": "Filters the array of shared settings.",
- "long_description": "Low level hook for registration of new data late in the cycle. This is deprecated. Instead, use the data api:\n ```php Automattic\\WooCommerce\\Blocks\\Package::container()->get( Automattic\\WooCommerce\\Blocks\\Assets\\AssetDataRegistry::class )->add( $key, $value ) ```",
- "tags": [
- {
- "name": "deprecated",
- "content": ""
- },
- {
- "name": "param",
- "content": "Settings data.",
- "types": [
- "array"
- ],
- "variable": "$data"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "array"
- ]
- }
- ],
- "long_description_html": "Low level hook for registration of new data late in the cycle. This is deprecated. Instead, use the data api:
Automattic\\WooCommerce\\Blocks\\Package::container()->get( Automattic\\WooCommerce\\Blocks\\Assets\\AssetDataRegistry::class )->add( $key, $value )
"
- },
- "args": 1
- },
- {
- "name": "woocommerce_shipping_package_name",
- "file": "StoreApi/Utilities/CartController.php",
- "type": "filter",
- "doc": {
- "description": "Filters the shipping package name.",
- "long_description": "",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "Shipping package name.",
- "types": [
- "string"
- ],
- "variable": "$shipping_package_name"
- },
- {
- "name": "param",
- "content": "Shipping package ID.",
- "types": [
- "string"
- ],
- "variable": "$package_id"
- },
- {
- "name": "param",
- "content": "Shipping package from WooCommerce.",
- "types": [
- "array"
- ],
- "variable": "$package"
- },
- {
- "name": "return",
- "content": "Shipping package name.",
- "types": [
- "string"
- ]
- }
- ],
- "long_description_html": ""
- },
- "args": 3
- },
- {
- "name": "woocommerce_show_page_title",
- "file": "BlockTypes/ClassicTemplate.php",
- "type": "filter",
- "doc": {
- "description": "We need to load the scripts here because when using block templates wp_head() gets run after the block template. As a result we are trying to enqueue required scripts before we have even registered them.",
- "long_description": "",
- "tags": [
- {
- "name": "see",
- "content": "",
- "refers": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/5328#issuecomment-989013447"
- }
- ],
- "long_description_html": ""
- },
- "args": 1
- },
- {
- "name": "woocommerce_store_api_disable_nonce_check",
- "file": "StoreApi/Routes/V1/AbstractCartRoute.php",
- "type": "filter",
- "doc": {
- "description": "Filters the Store API nonce check.",
- "long_description": "This can be used to disable the nonce check when testing API endpoints via a REST API client.",
- "tags": [
- {
- "name": "param",
- "content": "If true, nonce checks will be disabled.",
- "types": [
- "boolean"
- ],
- "variable": "$disable_nonce_check"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "boolean"
- ]
- }
- ],
- "long_description_html": "This can be used to disable the nonce check when testing API endpoints via a REST API client.
"
- },
- "args": 1
- },
- {
- "name": "woocommerce_store_api_product_quantity_limit",
- "file": "StoreApi/Utilities/QuantityLimits.php",
- "type": "filter",
- "doc": {
- "description": "Filters the quantity limit for a product being added to the cart via the Store API.",
- "long_description": "Filters the variation option name for custom option slugs.",
- "tags": [
- {
- "name": "param",
- "content": "Quantity limit which defaults to 9999 unless sold individually.",
- "types": [
- "integer"
- ],
- "variable": "$quantity_limit"
- },
- {
- "name": "param",
- "content": "Product instance.",
- "types": [
- "\\WC_Product"
- ],
- "variable": "$product"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "integer"
- ]
- }
- ],
- "long_description_html": "Filters the variation option name for custom option slugs.
"
- },
- "args": 2
- },
- {
- "name": "woocommerce_store_api_product_quantity_{$value_type}",
- "file": "StoreApi/Utilities/QuantityLimits.php",
- "type": "filter",
- "doc": {
- "description": "Filters the quantity minimum for a cart item in Store API. This allows extensions to control the minimum qty of items already within the cart.",
- "long_description": "The suffix of the hook will vary depending on the value being filtered. For example, minimum, maximum, multiple_of, editable.",
- "tags": [
- {
- "name": "param",
- "content": "The value being filtered.",
- "types": [
- "mixed"
- ],
- "variable": "$value"
- },
- {
- "name": "param",
- "content": "The product object.",
- "types": [
- "\\WC_Product"
- ],
- "variable": "$product"
- },
- {
- "name": "param",
- "content": "The cart item if the product exists in the cart, or null.",
- "types": [
- "array",
- "null"
- ],
- "variable": "$cart_item"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "mixed"
- ]
- }
- ],
- "long_description_html": "The suffix of the hook will vary depending on the value being filtered. For example, minimum, maximum, multiple_of, editable.
"
- },
- "args": 3
- },
- {
- "name": "woocommerce_variation_option_name",
- "file": "StoreApi/Schemas/V1/CartItemSchema.php",
- "type": "filter",
- "doc": {
- "description": "Filters the variation option name.",
- "long_description": "Filters the variation option name for custom option slugs.",
- "tags": [
- {
- "name": "internal",
- "content": "Matches filter name in WooCommerce core."
- },
- {
- "name": "param",
- "content": "The name to display.",
- "types": [
- "string"
- ],
- "variable": "$value"
- },
- {
- "name": "param",
- "content": "Unused because this is not a variation taxonomy.",
- "types": [
- "null"
- ],
- "variable": "$unused"
- },
- {
- "name": "param",
- "content": "Taxonomy or product attribute name.",
- "types": [
- "string"
- ],
- "variable": "$taxonomy"
- },
- {
- "name": "param",
- "content": "Product data.",
- "types": [
- "\\WC_Product"
- ],
- "variable": "$product"
- },
- {
- "name": "return",
- "content": "",
- "types": [
- "string"
- ]
- }
- ],
- "long_description_html": "Filters the variation option name for custom option slugs.
"
- },
- "args": 4
- }
- ]
-}
\ No newline at end of file
+ "$schema": "https://raw.githubusercontent.com/johnbillion/wp-hooks-generator/0.7.3/schema.json",
+ "hooks": [
+ {
+ "name": "__experimental_woocommerce_blocks_add_data_attributes_to_block",
+ "file": "BlockTypesController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the list of allowed Block Names",
+ "long_description": "This hook defines which block names should have block name and attribute data- attributes appended on render.",
+ "tags": [
+ {
+ "name": "param",
+ "content": "List of namespaces.",
+ "types": [ "array" ],
+ "variable": "$allowed_namespaces"
+ }
+ ],
+ "long_description_html": "This hook defines which block names should have block name and attribute data- attributes appended on render.
"
+ },
+ "args": 1
+ },
+ {
+ "name": "__experimental_woocommerce_blocks_add_data_attributes_to_namespace",
+ "file": "BlockTypesController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the list of allowed block namespaces.",
+ "long_description": "This hook defines which block namespaces should have block name and attribute `data-` attributes appended on render.",
+ "tags": [
+ {
+ "name": "param",
+ "content": "List of namespaces.",
+ "types": [ "array" ],
+ "variable": "$allowed_namespaces"
+ }
+ ],
+ "long_description_html": "This hook defines which block namespaces should have block name and attribute data-
attributes appended on render.
"
+ },
+ "args": 1
+ },
+ {
+ "name": "__experimental_woocommerce_blocks_payment_gateway_features_list",
+ "file": "Payments/Integrations/PayPal.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filter to control what features are available for each payment gateway.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "example",
+ "content": "docs/examples/payment-gateways-features-list.md"
+ },
+ {
+ "name": "param",
+ "content": "List of supported features.",
+ "types": [ "array" ],
+ "variable": "$features"
+ },
+ {
+ "name": "param",
+ "content": "Gateway name.",
+ "types": [ "string" ],
+ "variable": "$name"
+ },
+ {
+ "name": "return",
+ "content": "Updated list of supported features.",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_add_cart_item",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the item being added to the cart.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Array of cart item data being added to the cart.",
+ "types": [ "array" ],
+ "variable": "$cart_item_data"
+ },
+ {
+ "name": "param",
+ "content": "Id of the item in the cart.",
+ "types": [ "string" ],
+ "variable": "$cart_id"
+ },
+ {
+ "name": "return",
+ "content": "Updated cart item data.",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_add_cart_item_data",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filter cart item data for add to cart requests.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Array of other cart item data.",
+ "types": [ "array" ],
+ "variable": "$cart_item_data"
+ },
+ {
+ "name": "param",
+ "content": "ID of the product added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$product_id"
+ },
+ {
+ "name": "param",
+ "content": "Variation ID of the product added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$variation_id"
+ },
+ {
+ "name": "param",
+ "content": "Quantity of the item added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$quantity"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 4
+ },
+ {
+ "name": "woocommerce_add_to_cart_sold_individually_quantity",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filter sold individually quantity for add to cart requests.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Defaults to 1.",
+ "types": [ "integer" ],
+ "variable": "$sold_individually_quantity"
+ },
+ {
+ "name": "param",
+ "content": "Quantity of the item added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$quantity"
+ },
+ {
+ "name": "param",
+ "content": "ID of the product added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$product_id"
+ },
+ {
+ "name": "param",
+ "content": "Variation ID of the product added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$variation_id"
+ },
+ {
+ "name": "param",
+ "content": "Array of other cart item data.",
+ "types": [ "array" ],
+ "variable": "$cart_item_data"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "integer" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 5
+ },
+ {
+ "name": "woocommerce_add_to_cart_validation",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters if an item being added to the cart passed validation checks.",
+ "long_description": "Allow 3rd parties to validate if an item can be added to the cart. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to exceptions instead.",
+ "tags": [
+ {
+ "name": "deprecated",
+ "content": ""
+ },
+ {
+ "name": "param",
+ "content": "True if the item passed validation.",
+ "types": [ "boolean" ],
+ "variable": "$passed_validation"
+ },
+ {
+ "name": "param",
+ "content": "Product ID being validated.",
+ "types": [ "integer" ],
+ "variable": "$product_id"
+ },
+ {
+ "name": "param",
+ "content": "Quantity added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$quantity"
+ },
+ {
+ "name": "param",
+ "content": "Variation ID being added to the cart.",
+ "types": [ "integer" ],
+ "variable": "$variation_id"
+ },
+ {
+ "name": "param",
+ "content": "Variation data.",
+ "types": [ "array" ],
+ "variable": "$variation"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "boolean" ]
+ }
+ ],
+ "long_description_html": "Allow 3rd parties to validate if an item can be added to the cart. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to exceptions instead.
"
+ },
+ "args": 5
+ },
+ {
+ "name": "woocommerce_adjust_non_base_location_prices",
+ "file": "StoreApi/Utilities/ProductQuery.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters if taxes should be removed from locations outside the store base location.",
+ "long_description": "The woocommerce_adjust_non_base_location_prices filter can stop base taxes being taken off when dealing with out of base locations. e.g. If a product costs 10 including tax, all users will pay 10 regardless of location and taxes.",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "True by default.",
+ "types": [ "boolean" ],
+ "variable": "$adjust_non_base_location_prices"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "boolean" ]
+ }
+ ],
+ "long_description_html": "The woocommerce_adjust_non_base_location_prices filter can stop base taxes being taken off when dealing with out of base locations. e.g. If a product costs 10 including tax, all users will pay 10 regardless of location and taxes.
"
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_admin_disabled",
+ "file": "InboxNotifications.php",
+ "type": "filter",
+ "doc": {
+ "description": "",
+ "long_description": "",
+ "tags": [],
+ "long_description_html": ""
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_apply_individual_use_coupon",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filter coupons to remove when applying an individual use coupon.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Array of coupons to remove from the cart.",
+ "types": [ "array" ],
+ "variable": "$coupons"
+ },
+ {
+ "name": "param",
+ "content": "Coupon object applied to the cart.",
+ "types": [ "\\WC_Coupon" ],
+ "variable": "$coupon"
+ },
+ {
+ "name": "param",
+ "content": "Array of applied coupons already applied to the cart.",
+ "types": [ "array" ],
+ "variable": "$applied_coupons"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 3
+ },
+ {
+ "name": "woocommerce_apply_with_individual_use_coupon",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters if a coupon can be applied alongside other individual use coupons.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Defaults to false.",
+ "types": [ "boolean" ],
+ "variable": "$apply_with_individual_use_coupon"
+ },
+ {
+ "name": "param",
+ "content": "Coupon object applied to the cart.",
+ "types": [ "\\WC_Coupon" ],
+ "variable": "$coupon"
+ },
+ {
+ "name": "param",
+ "content": "Individual use coupon already applied to the cart.",
+ "types": [ "\\WC_Coupon" ],
+ "variable": "$individual_use_coupon"
+ },
+ {
+ "name": "param",
+ "content": "Array of applied coupons already applied to the cart.",
+ "types": [ "array" ],
+ "variable": "$applied_coupons"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "boolean" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 4
+ },
+ {
+ "name": "woocommerce_blocks_product_grid_is_cacheable",
+ "file": "BlockTypes/AbstractProductGrid.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters whether or not the product grid is cacheable.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "param",
+ "content": "The list of script dependencies.",
+ "types": [ "boolean" ],
+ "variable": "$is_cacheable"
+ },
+ {
+ "name": "param",
+ "content": "Query args for the products query passed to BlocksWpQuery.",
+ "types": [ "array" ],
+ "variable": "$query_args"
+ },
+ {
+ "name": "return",
+ "content": "True to enable cache, false to disable cache.",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_blocks_product_grid_item_html",
+ "file": "BlockTypes/AbstractProductGrid.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the HTML for products in the grid.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "param",
+ "content": "Product grid item HTML.",
+ "types": [ "string" ],
+ "variable": "$html"
+ },
+ {
+ "name": "param",
+ "content": "Product data passed to the template.",
+ "types": [ "array" ],
+ "variable": "$data"
+ },
+ {
+ "name": "param",
+ "content": "Product object.",
+ "types": [ "\\WC_Product" ],
+ "variable": "$product"
+ },
+ {
+ "name": "return",
+ "content": "Updated product grid item HTML.",
+ "types": [ "string" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 3
+ },
+ {
+ "name": "woocommerce_blocks_register_script_dependencies",
+ "file": "Assets/Api.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the list of script dependencies.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "param",
+ "content": "The list of script dependencies.",
+ "types": [ "array" ],
+ "variable": "$dependencies"
+ },
+ {
+ "name": "param",
+ "content": "The script's handle.",
+ "types": [ "string" ],
+ "variable": "$handle"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_cart_contents_changed",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the entire cart contents when the cart changes.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Array of all cart items.",
+ "types": [ "array" ],
+ "variable": "$cart_contents"
+ },
+ {
+ "name": "return",
+ "content": "Updated array of all cart items.",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_ga_disable_tracking",
+ "file": "Domain/Services/GoogleAnalytics.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filter to disable Google Analytics tracking.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in GA extension."
+ },
+ {
+ "name": "param",
+ "content": "If true, tracking will be disabled.",
+ "types": [ "boolean" ],
+ "variable": "$disable_tracking"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_get_item_data",
+ "file": "StoreApi/Schemas/V1/CartItemSchema.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters cart item data.",
+ "long_description": "Filters the variation option name for custom option slugs.",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Cart item data. Empty by default.",
+ "types": [ "array" ],
+ "variable": "$item_data"
+ },
+ {
+ "name": "param",
+ "content": "Cart item array.",
+ "types": [ "array" ],
+ "variable": "$cart_item"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": "Filters the variation option name for custom option slugs.
"
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_new_customer_data",
+ "file": "StoreApi/Routes/V1/Checkout.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters customer data before a customer account is registered.",
+ "long_description": "This hook filters customer data. It allows user data to be changed, for example, username, password, email, first name, last name, and role.",
+ "tags": [
+ {
+ "name": "param",
+ "content": "An array of customer (user) data.",
+ "types": [ "array" ],
+ "variable": "$customer_data"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": "This hook filters customer data. It allows user data to be changed, for example, username, password, email, first name, last name, and role.
"
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_registration_errors",
+ "file": "StoreApi/Routes/V1/Checkout.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters registration errors before a customer account is registered.",
+ "long_description": "This hook filters registration errors. This can be used to manipulate the array of errors before they are displayed.",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Error object.",
+ "types": [ "\\WP_Error" ],
+ "variable": "$errors"
+ },
+ {
+ "name": "param",
+ "content": "Customer username.",
+ "types": [ "string" ],
+ "variable": "$username"
+ },
+ {
+ "name": "param",
+ "content": "Customer email address.",
+ "types": [ "string" ],
+ "variable": "$user_email"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "\\WP_Error" ]
+ }
+ ],
+ "long_description_html": "This hook filters registration errors. This can be used to manipulate the array of errors before they are displayed.
"
+ },
+ "args": 3
+ },
+ {
+ "name": "woocommerce_shared_settings",
+ "file": "Assets/AssetDataRegistry.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the array of shared settings.",
+ "long_description": "Low level hook for registration of new data late in the cycle. This is deprecated. Instead, use the data api:\n ```php Automattic\\WooCommerce\\Blocks\\Package::container()->get( Automattic\\WooCommerce\\Blocks\\Assets\\AssetDataRegistry::class )->add( $key, $value ) ```",
+ "tags": [
+ {
+ "name": "deprecated",
+ "content": ""
+ },
+ {
+ "name": "param",
+ "content": "Settings data.",
+ "types": [ "array" ],
+ "variable": "$data"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "array" ]
+ }
+ ],
+ "long_description_html": "Low level hook for registration of new data late in the cycle. This is deprecated. Instead, use the data api:
Automattic\\WooCommerce\\Blocks\\Package::container()->get( Automattic\\WooCommerce\\Blocks\\Assets\\AssetDataRegistry::class )->add( $key, $value )
"
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_shipping_package_name",
+ "file": "StoreApi/Utilities/CartController.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the shipping package name.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "Shipping package name.",
+ "types": [ "string" ],
+ "variable": "$shipping_package_name"
+ },
+ {
+ "name": "param",
+ "content": "Shipping package ID.",
+ "types": [ "string" ],
+ "variable": "$package_id"
+ },
+ {
+ "name": "param",
+ "content": "Shipping package from WooCommerce.",
+ "types": [ "array" ],
+ "variable": "$package"
+ },
+ {
+ "name": "return",
+ "content": "Shipping package name.",
+ "types": [ "string" ]
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 3
+ },
+ {
+ "name": "woocommerce_show_page_title",
+ "file": "BlockTypes/ClassicTemplate.php",
+ "type": "filter",
+ "doc": {
+ "description": "We need to load the scripts here because when using block templates wp_head() gets run after the block template. As a result we are trying to enqueue required scripts before we have even registered them.",
+ "long_description": "",
+ "tags": [
+ {
+ "name": "see",
+ "content": "",
+ "refers": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/5328#issuecomment-989013447"
+ }
+ ],
+ "long_description_html": ""
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_store_api_disable_nonce_check",
+ "file": "StoreApi/Routes/V1/AbstractCartRoute.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the Store API nonce check.",
+ "long_description": "This can be used to disable the nonce check when testing API endpoints via a REST API client.",
+ "tags": [
+ {
+ "name": "param",
+ "content": "If true, nonce checks will be disabled.",
+ "types": [ "boolean" ],
+ "variable": "$disable_nonce_check"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "boolean" ]
+ }
+ ],
+ "long_description_html": "This can be used to disable the nonce check when testing API endpoints via a REST API client.
"
+ },
+ "args": 1
+ },
+ {
+ "name": "woocommerce_store_api_product_quantity_limit",
+ "file": "StoreApi/Utilities/QuantityLimits.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the quantity limit for a product being added to the cart via the Store API.",
+ "long_description": "Filters the variation option name for custom option slugs.",
+ "tags": [
+ {
+ "name": "param",
+ "content": "Quantity limit which defaults to 9999 unless sold individually.",
+ "types": [ "integer" ],
+ "variable": "$quantity_limit"
+ },
+ {
+ "name": "param",
+ "content": "Product instance.",
+ "types": [ "\\WC_Product" ],
+ "variable": "$product"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "integer" ]
+ }
+ ],
+ "long_description_html": "Filters the variation option name for custom option slugs.
"
+ },
+ "args": 2
+ },
+ {
+ "name": "woocommerce_store_api_product_quantity_{$value_type}",
+ "file": "StoreApi/Utilities/QuantityLimits.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the quantity minimum for a cart item in Store API. This allows extensions to control the minimum qty of items already within the cart.",
+ "long_description": "The suffix of the hook will vary depending on the value being filtered. For example, minimum, maximum, multiple_of, editable.",
+ "tags": [
+ {
+ "name": "param",
+ "content": "The value being filtered.",
+ "types": [ "mixed" ],
+ "variable": "$value"
+ },
+ {
+ "name": "param",
+ "content": "The product object.",
+ "types": [ "\\WC_Product" ],
+ "variable": "$product"
+ },
+ {
+ "name": "param",
+ "content": "The cart item if the product exists in the cart, or null.",
+ "types": [ "array", "null" ],
+ "variable": "$cart_item"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "mixed" ]
+ }
+ ],
+ "long_description_html": "The suffix of the hook will vary depending on the value being filtered. For example, minimum, maximum, multiple_of, editable.
"
+ },
+ "args": 3
+ },
+ {
+ "name": "woocommerce_variation_option_name",
+ "file": "StoreApi/Schemas/V1/CartItemSchema.php",
+ "type": "filter",
+ "doc": {
+ "description": "Filters the variation option name.",
+ "long_description": "Filters the variation option name for custom option slugs.",
+ "tags": [
+ {
+ "name": "internal",
+ "content": "Matches filter name in WooCommerce core."
+ },
+ {
+ "name": "param",
+ "content": "The name to display.",
+ "types": [ "string" ],
+ "variable": "$value"
+ },
+ {
+ "name": "param",
+ "content": "Unused because this is not a variation taxonomy.",
+ "types": [ "null" ],
+ "variable": "$unused"
+ },
+ {
+ "name": "param",
+ "content": "Taxonomy or product attribute name.",
+ "types": [ "string" ],
+ "variable": "$taxonomy"
+ },
+ {
+ "name": "param",
+ "content": "Product data.",
+ "types": [ "\\WC_Product" ],
+ "variable": "$product"
+ },
+ {
+ "name": "return",
+ "content": "",
+ "types": [ "string" ]
+ }
+ ],
+ "long_description_html": "Filters the variation option name for custom option slugs.
"
+ },
+ "args": 4
+ }
+ ]
+}
diff --git a/plugins/woocommerce-blocks/bin/hook-docs/filters/index.js b/plugins/woocommerce-blocks/bin/hook-docs/filters/index.js
index a5d2fde3937..2d114ad10d3 100644
--- a/plugins/woocommerce-blocks/bin/hook-docs/filters/index.js
+++ b/plugins/woocommerce-blocks/bin/hook-docs/filters/index.js
@@ -32,8 +32,7 @@ const generate = ( hooks ) => {
const jsonDocs = [
{ html: '' },
{
- html:
- '',
+ html: '',
},
{ h1: 'Filters' },
{ h2: 'Table of Contents' },
diff --git a/plugins/woocommerce-blocks/bin/webpack-configs.js b/plugins/woocommerce-blocks/bin/webpack-configs.js
index 2d2ad7684e7..b2e8374333d 100644
--- a/plugins/woocommerce-blocks/bin/webpack-configs.js
+++ b/plugins/woocommerce-blocks/bin/webpack-configs.js
@@ -711,10 +711,8 @@ const getStylingConfig = ( options = {} ) => {
includePaths: [ 'assets/css/abstracts' ],
},
additionalData: ( content, loaderContext ) => {
- const {
- resourcePath,
- rootContext,
- } = loaderContext;
+ const { resourcePath, rootContext } =
+ loaderContext;
const relativePath = path.relative(
rootContext,
resourcePath
diff --git a/plugins/woocommerce-blocks/package-lock.json b/plugins/woocommerce-blocks/package-lock.json
index 444ae211ac0..1605dad4d41 100644
--- a/plugins/woocommerce-blocks/package-lock.json
+++ b/plugins/woocommerce-blocks/package-lock.json
@@ -93,6 +93,7 @@
"@wordpress/html-entities": "3.2.3",
"@wordpress/i18n": "4.2.4",
"@wordpress/is-shallow-equal": "4.2.1",
+ "@wordpress/prettier-config": "^1.1.1",
"@wordpress/scripts": "22.3.0",
"autoprefixer": "10.3.7",
"axios": "0.21.4",
@@ -138,10 +139,10 @@
"patch-package": "6.4.7",
"postcss": "8.2.13",
"postcss-loader": "4.2.0",
- "prettier": "npm:wp-prettier@2.0.5",
+ "prettier": "npm:wp-prettier@2.6.2",
"progress-bar-webpack-plugin": "2.1.0",
"promptly": "3.2.0",
- "puppeteer": "^13.7.0",
+ "puppeteer": "13.7.0",
"react-docgen": "5.4.0",
"react-test-renderer": "17.0.2",
"request-promise": "4.2.6",
@@ -39459,10 +39460,19 @@
},
"node_modules/prettier": {
"name": "wp-prettier",
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz",
- "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==",
- "dev": true
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.6.2.tgz",
+ "integrity": "sha512-AV33EzqiFJ3fj+mPlKABN59YFPReLkDxQnj067Z3uEOeRQf3g05WprL0RDuqM7UBhSRo9W1rMSC2KvZmjE5UOA==",
+ "dev": true,
+ "bin": {
+ "prettier": "bin-prettier.js"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
},
"node_modules/prettier-linter-helpers": {
"version": "1.0.0",
@@ -79483,9 +79493,9 @@
"optional": true
},
"prettier": {
- "version": "npm:wp-prettier@2.0.5",
- "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.0.5.tgz",
- "integrity": "sha512-5GCgdeevIXwR3cW4Qj5XWC5MO1iSCz8+IPn0mMw6awAt/PBiey8yyO7MhePRsaMqghJAhg6Q3QLYWSnUHWkG6A==",
+ "version": "npm:wp-prettier@2.6.2",
+ "resolved": "https://registry.npmjs.org/wp-prettier/-/wp-prettier-2.6.2.tgz",
+ "integrity": "sha512-AV33EzqiFJ3fj+mPlKABN59YFPReLkDxQnj067Z3uEOeRQf3g05WprL0RDuqM7UBhSRo9W1rMSC2KvZmjE5UOA==",
"dev": true
},
"prettier-linter-helpers": {
diff --git a/plugins/woocommerce-blocks/package.json b/plugins/woocommerce-blocks/package.json
index 7d76bf4bb2d..3272692faf5 100644
--- a/plugins/woocommerce-blocks/package.json
+++ b/plugins/woocommerce-blocks/package.json
@@ -143,6 +143,7 @@
"@wordpress/i18n": "4.2.4",
"@wordpress/is-shallow-equal": "4.2.1",
"@wordpress/scripts": "22.3.0",
+ "@wordpress/prettier-config": "^1.1.1",
"autoprefixer": "10.3.7",
"axios": "0.21.4",
"babel-plugin-explicit-exports-references": "^1.0.2",
@@ -187,7 +188,7 @@
"patch-package": "6.4.7",
"postcss": "8.2.13",
"postcss-loader": "4.2.0",
- "prettier": "npm:wp-prettier@2.0.5",
+ "prettier": "npm:wp-prettier@2.6.2",
"progress-bar-webpack-plugin": "2.1.0",
"promptly": "3.2.0",
"puppeteer": "13.7.0",
diff --git a/plugins/woocommerce-blocks/packages/checkout/components/discounts-meta/index.js b/plugins/woocommerce-blocks/packages/checkout/components/discounts-meta/index.js
index 267adf39db4..3f87627a7e8 100644
--- a/plugins/woocommerce-blocks/packages/checkout/components/discounts-meta/index.js
+++ b/plugins/woocommerce-blocks/packages/checkout/components/discounts-meta/index.js
@@ -11,10 +11,8 @@ import TotalsWrapper from '../totals-wrapper';
const slotName = '__experimentalDiscountsMeta';
-const {
- Fill: ExperimentalDiscountsMeta,
- Slot: DiscountsMetaSlot,
-} = createSlotFill( slotName );
+const { Fill: ExperimentalDiscountsMeta, Slot: DiscountsMetaSlot } =
+ createSlotFill( slotName );
const Slot = ( { className, extensions, cart, context } ) => {
const { fills } = useSlot( slotName );
diff --git a/plugins/woocommerce-blocks/packages/checkout/components/order-meta/index.js b/plugins/woocommerce-blocks/packages/checkout/components/order-meta/index.js
index 7c86bc632ee..39c7a096107 100644
--- a/plugins/woocommerce-blocks/packages/checkout/components/order-meta/index.js
+++ b/plugins/woocommerce-blocks/packages/checkout/components/order-meta/index.js
@@ -11,9 +11,8 @@ import TotalsWrapper from '../totals-wrapper';
const slotName = '__experimentalOrderMeta';
-const { Fill: ExperimentalOrderMeta, Slot: OrderMetaSlot } = createSlotFill(
- slotName
-);
+const { Fill: ExperimentalOrderMeta, Slot: OrderMetaSlot } =
+ createSlotFill( slotName );
const Slot = ( { className, extensions, cart, context } ) => {
const { fills } = useSlot( slotName );
diff --git a/plugins/woocommerce-blocks/packages/checkout/filter-registry/index.ts b/plugins/woocommerce-blocks/packages/checkout/filter-registry/index.ts
index 854ddc510cf..da3674d9269 100644
--- a/plugins/woocommerce-blocks/packages/checkout/filter-registry/index.ts
+++ b/plugins/woocommerce-blocks/packages/checkout/filter-registry/index.ts
@@ -49,8 +49,7 @@ export const __experimentalRegisterCheckoutFilters = (
deprecated( 'snackbarNotices', {
alternative: 'snackbarNoticeVisibility',
plugin: 'WooCommerce Blocks',
- link:
- 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4417',
+ link: 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4417',
} );
}
@@ -63,8 +62,7 @@ export const __experimentalRegisterCheckoutFilters = (
deprecated( 'couponName', {
alternative: 'coupons',
plugin: 'WooCommerce Blocks',
- link:
- 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/bb921d21f42e21f38df2b1c87b48e07aa4cb0538/docs/extensibility/available-filters.md#coupons',
+ link: 'https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/bb921d21f42e21f38df2b1c87b48e07aa4cb0538/docs/extensibility/available-filters.md#coupons',
} );
}
diff --git a/plugins/woocommerce-blocks/packages/prices/utils/price.ts b/plugins/woocommerce-blocks/packages/prices/utils/price.ts
index 40b76974de3..54a7779d744 100644
--- a/plugins/woocommerce-blocks/packages/prices/utils/price.ts
+++ b/plugins/woocommerce-blocks/packages/prices/utils/price.ts
@@ -178,13 +178,8 @@ export const formatPrice = (
const currency: Currency = getCurrency( currencyData );
- const {
- minorUnit,
- prefix,
- suffix,
- decimalSeparator,
- thousandSeparator,
- } = currency;
+ const { minorUnit, prefix, suffix, decimalSeparator, thousandSeparator } =
+ currency;
const formattedPrice: number = priceInt / 10 ** minorUnit;
diff --git a/plugins/woocommerce-blocks/storybook/custom-controls/currency.ts b/plugins/woocommerce-blocks/storybook/custom-controls/currency.ts
index ce6b175a615..2c1d39e8f1f 100644
--- a/plugins/woocommerce-blocks/storybook/custom-controls/currency.ts
+++ b/plugins/woocommerce-blocks/storybook/custom-controls/currency.ts
@@ -25,15 +25,13 @@ export const currencies: Record< string, Currency > = {
},
} as const;
-export const currenciesAPIShape: Record<
- string,
- CurrencyResponse
-> = Object.fromEntries(
- Object.entries( currencies ).map( ( [ key, value ] ) => [
- key,
- snakecaseKeys( value ),
- ] )
-);
+export const currenciesAPIShape: Record< string, CurrencyResponse > =
+ Object.fromEntries(
+ Object.entries( currencies ).map( ( [ key, value ] ) => [
+ key,
+ snakecaseKeys( value ),
+ ] )
+ );
export const currencyControl = {
control: 'select',
diff --git a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/best-selling-products.fixture.json b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/best-selling-products.fixture.json
index 83be6820f4d..592c5ded3ea 100644
--- a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/best-selling-products.fixture.json
+++ b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/best-selling-products.fixture.json
@@ -1 +1,4 @@
-{"title":"Best Selling Products Block","pageContent":""}
\ No newline at end of file
+{
+ "title": "Best Selling Products Block",
+ "pageContent": ""
+}
diff --git a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/featured-category.fixture.json b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/featured-category.fixture.json
index 60f0ae7b0d9..b6c77eb3381 100644
--- a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/featured-category.fixture.json
+++ b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/featured-category.fixture.json
@@ -1 +1,4 @@
-{"title":"Featured Category Block","pageContent":""}
\ No newline at end of file
+{
+ "title": "Featured Category Block",
+ "pageContent": ""
+}
diff --git a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/hand-picked-products.fixture.json b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/hand-picked-products.fixture.json
index 907b84ea5ec..4b2f1de3f43 100644
--- a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/hand-picked-products.fixture.json
+++ b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/hand-picked-products.fixture.json
@@ -1 +1,4 @@
-{"title":"Hand-picked Products Block","pageContent":""}
\ No newline at end of file
+{
+ "title": "Hand-picked Products Block",
+ "pageContent": ""
+}
diff --git a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/newest-products.fixture.json b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/newest-products.fixture.json
index 5ffe302fc75..d3aa952f8b7 100644
--- a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/newest-products.fixture.json
+++ b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/newest-products.fixture.json
@@ -1 +1,4 @@
-{"title":"Newest Products Block","pageContent":""}
\ No newline at end of file
+{
+ "title": "Newest Products Block",
+ "pageContent": ""
+}
diff --git a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/product-categories-list.fixture.json b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/product-categories-list.fixture.json
index 7e6a4d9e3bb..6f6baf27aef 100644
--- a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/product-categories-list.fixture.json
+++ b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/product-categories-list.fixture.json
@@ -1 +1,4 @@
-{"title":"Product Categories List Block","pageContent":""}
\ No newline at end of file
+{
+ "title": "Product Categories List Block",
+ "pageContent": ""
+}
diff --git a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/top-rated-products.fixture.json b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/top-rated-products.fixture.json
index 4adb6788563..a3190e493b4 100644
--- a/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/top-rated-products.fixture.json
+++ b/plugins/woocommerce-blocks/tests/e2e/config/custom-matchers/__fixtures__/top-rated-products.fixture.json
@@ -1 +1,4 @@
-{"title":"Top Rated Products Block","pageContent":""}
\ No newline at end of file
+{
+ "title": "Top Rated Products Block",
+ "pageContent": ""
+}
diff --git a/plugins/woocommerce-blocks/tests/e2e/config/setup.js b/plugins/woocommerce-blocks/tests/e2e/config/setup.js
index 10a2684115d..3b57bb981a1 100644
--- a/plugins/woocommerce-blocks/tests/e2e/config/setup.js
+++ b/plugins/woocommerce-blocks/tests/e2e/config/setup.js
@@ -49,14 +49,8 @@ module.exports = async ( globalConfig ) => {
enablePaymentGateways(),
setupPageSettings(),
] ).catch( console.log );
- const [
- taxes,
- coupons,
- categories,
- tags,
- shippingZones,
- attributes,
- ] = results;
+ const [ taxes, coupons, categories, tags, shippingZones, attributes ] =
+ results;
// Create products after categories.
const products = await createProducts( categories, tags, attributes );
diff --git a/plugins/woocommerce-blocks/tests/e2e/fixtures/fixture-data.js b/plugins/woocommerce-blocks/tests/e2e/fixtures/fixture-data.js
index af7ae386864..382a03c6732 100644
--- a/plugins/woocommerce-blocks/tests/e2e/fixtures/fixture-data.js
+++ b/plugins/woocommerce-blocks/tests/e2e/fixtures/fixture-data.js
@@ -152,14 +152,12 @@ const Products = () => [
downloads: [
{
name: 'Woo Single',
- file:
- 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
+ file: 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
},
],
images: [
{
- src:
- 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
+ src: 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
},
],
categories: [ 'Music' ],
@@ -172,8 +170,7 @@ const Products = () => [
downloadable: false,
images: [
{
- src:
- 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
+ src: 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
},
],
attributes: [
@@ -194,8 +191,7 @@ const Products = () => [
downloadable: false,
images: [
{
- src:
- 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
+ src: 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
},
],
attributes: [
@@ -216,14 +212,12 @@ const Products = () => [
downloads: [
{
name: 'Woo Single 2',
- file:
- 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
+ file: 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
},
],
images: [
{
- src:
- 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
+ src: 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
},
],
categories: [ 'Music' ],
@@ -238,14 +232,12 @@ const Products = () => [
downloads: [
{
name: 'Woo Single 2',
- file:
- 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
+ file: 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
},
],
images: [
{
- src:
- 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
+ src: 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/cd_4_angle.jpg',
},
],
categories: [ 'Music' ],
diff --git a/plugins/woocommerce-blocks/tests/e2e/fixtures/fixture-loaders.js b/plugins/woocommerce-blocks/tests/e2e/fixtures/fixture-loaders.js
index a343985336b..f734d8c0b74 100644
--- a/plugins/woocommerce-blocks/tests/e2e/fixtures/fixture-loaders.js
+++ b/plugins/woocommerce-blocks/tests/e2e/fixtures/fixture-loaders.js
@@ -1,8 +1,8 @@
/**
* External dependencies
*/
-const WooCommerceRestApi = require( '@woocommerce/woocommerce-rest-api' )
- .default;
+const WooCommerceRestApi =
+ require( '@woocommerce/woocommerce-rest-api' ).default;
const glob = require( 'glob-promise' );
const { dirname } = require( 'path' );
const { readJson } = require( 'fs-extra' );
diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/backend/active-filters.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/backend/active-filters.test.js
index 157a0c31f08..6c81df7e098 100644
--- a/plugins/woocommerce-blocks/tests/e2e/specs/backend/active-filters.test.js
+++ b/plugins/woocommerce-blocks/tests/e2e/specs/backend/active-filters.test.js
@@ -50,9 +50,7 @@ describe( `${ block.name } Block`, () => {
await page.click(
'.components-toolbar button[aria-label="Heading 6"]'
);
- await expect(
- page
- ).toMatchElement(
+ await expect( page ).toMatchElement(
`.wp-block[data-type="${ block.slug }"] h6 textarea`,
{ text: 'New Title' }
);
diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/backend/attribute-filter.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/backend/attribute-filter.test.js
index 7b1eebe40a7..a5b4678b6bf 100644
--- a/plugins/woocommerce-blocks/tests/e2e/specs/backend/attribute-filter.test.js
+++ b/plugins/woocommerce-blocks/tests/e2e/specs/backend/attribute-filter.test.js
@@ -62,9 +62,7 @@ describe( `${ block.name } Block`, () => {
await page.click(
'.components-toolbar button[aria-label="Heading 6"]'
);
- await expect(
- page
- ).toMatchElement(
+ await expect( page ).toMatchElement(
`.wp-block[data-type="${ block.slug }"] h6 textarea`,
{ text: 'New Title' }
);
diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/backend/price-filter.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/backend/price-filter.test.js
index 7a9750a08ca..6acd0887d0e 100644
--- a/plugins/woocommerce-blocks/tests/e2e/specs/backend/price-filter.test.js
+++ b/plugins/woocommerce-blocks/tests/e2e/specs/backend/price-filter.test.js
@@ -53,9 +53,7 @@ describe( `${ block.name } Block`, () => {
await page.click(
'.components-toolbar button[aria-label="Heading 6"]'
);
- await expect(
- page
- ).toMatchElement(
+ await expect( page ).toMatchElement(
`.wp-block[data-type="${ block.slug }"] h6 textarea`,
{ text: 'New Title' }
);
@@ -67,9 +65,7 @@ describe( `${ block.name } Block`, () => {
await page.click(
'.components-toolbar button[aria-label="Heading 3"]'
);
- await expect(
- page
- ).not.toMatchElement(
+ await expect( page ).not.toMatchElement(
`.wp-block[data-type="${ block.slug }"] h6 textarea`,
{ text: 'New Title' }
);
diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/frontend/legacy-template-blocks.test.ts b/plugins/woocommerce-blocks/tests/e2e/specs/frontend/legacy-template-blocks.test.ts
index 584ab749e5a..0cd13d14589 100644
--- a/plugins/woocommerce-blocks/tests/e2e/specs/frontend/legacy-template-blocks.test.ts
+++ b/plugins/woocommerce-blocks/tests/e2e/specs/frontend/legacy-template-blocks.test.ts
@@ -55,10 +55,8 @@ describe( 'Classic Template blocks', () => {
await page.waitForSelector( productArchivePage.productsList );
await page.waitForSelector( productArchivePage.resultsCount );
- const {
- displayedCount,
- shouldHavePaginationUI,
- } = await extractPaginationData();
+ const { displayedCount, shouldHavePaginationUI } =
+ await extractPaginationData();
if ( shouldHavePaginationUI ) {
await expect( page ).toMatchElement(
@@ -93,10 +91,8 @@ describe( 'Classic Template blocks', () => {
await page.waitForSelector( productArchivePage.productsList );
await page.waitForSelector( productArchivePage.resultsCount );
- const {
- displayedCount,
- shouldHavePaginationUI,
- } = await extractPaginationData();
+ const { displayedCount, shouldHavePaginationUI } =
+ await extractPaginationData();
if ( shouldHavePaginationUI ) {
await expect( page ).toMatchElement(
@@ -131,10 +127,8 @@ describe( 'Classic Template blocks', () => {
await page.waitForSelector( productArchivePage.productsList );
await page.waitForSelector( productArchivePage.resultsCount );
- const {
- displayedCount,
- shouldHavePaginationUI,
- } = await extractPaginationData();
+ const { displayedCount, shouldHavePaginationUI } =
+ await extractPaginationData();
if ( shouldHavePaginationUI ) {
await expect( page ).toMatchElement(
diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout/account.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout/account.test.js
index f49d30c85d9..89943d6400a 100644
--- a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout/account.test.js
+++ b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout/account.test.js
@@ -52,8 +52,7 @@ describe( 'Shopper → Checkout → Account', () => {
//Enable shoppers to sign up at checkout option.
// eslint-disable-next-line jest/no-standalone-expect
await expect( page ).toClick( 'label', {
- text:
- 'Allow shoppers to sign up for a user account during checkout',
+ text: 'Allow shoppers to sign up for a user account during checkout',
} );
await saveOrPublish();
await merchant.logout();
diff --git a/plugins/woocommerce-blocks/tests/e2e/utils.js b/plugins/woocommerce-blocks/tests/e2e/utils.js
index 74471db59af..b81f23da141 100644
--- a/plugins/woocommerce-blocks/tests/e2e/utils.js
+++ b/plugins/woocommerce-blocks/tests/e2e/utils.js
@@ -44,8 +44,7 @@ export const DEFAULT_TIMEOUT = 30000;
const SELECTORS = {
canvas: 'iframe[name="editor-canvas"]',
inserter: {
- search:
- '.components-search-control__input,.block-editor-inserter__search input,.block-editor-inserter__search-input,input.block-editor-inserter__search',
+ search: '.components-search-control__input,.block-editor-inserter__search input,.block-editor-inserter__search-input,input.block-editor-inserter__search',
},
templatesListTable: {
actionsContainer: '.edit-site-list-table__actions',
diff --git a/plugins/woocommerce-blocks/tests/js/jestPreprocess.js b/plugins/woocommerce-blocks/tests/js/jestPreprocess.js
index 40bf8c2621e..9baa877eae3 100644
--- a/plugins/woocommerce-blocks/tests/js/jestPreprocess.js
+++ b/plugins/woocommerce-blocks/tests/js/jestPreprocess.js
@@ -6,6 +6,5 @@ const babelOptions = {
],
};
-module.exports = require( 'babel-jest' ).default.createTransformer(
- babelOptions
-);
+module.exports =
+ require( 'babel-jest' ).default.createTransformer( babelOptions );
diff --git a/plugins/woocommerce-blocks/tests/utils/shopper.js b/plugins/woocommerce-blocks/tests/utils/shopper.js
index be2c75fff41..705449b549a 100644
--- a/plugins/woocommerce-blocks/tests/utils/shopper.js
+++ b/plugins/woocommerce-blocks/tests/utils/shopper.js
@@ -69,9 +69,7 @@ export const shopper = {
await expect( page ).toMatchElement( 'span', {
text: productTitle,
} );
- await expect(
- page
- ).toMatchElement(
+ await expect( page ).toMatchElement(
'div.wc-block-components-order-summary-item__quantity',
{ text: quantity }
);
diff --git a/plugins/woocommerce-blocks/tests/utils/taxes.ts b/plugins/woocommerce-blocks/tests/utils/taxes.ts
index c3bf4a5e08f..f4ffedc3ce1 100644
--- a/plugins/woocommerce-blocks/tests/utils/taxes.ts
+++ b/plugins/woocommerce-blocks/tests/utils/taxes.ts
@@ -72,8 +72,8 @@ export async function getTaxesFromOrderSummaryPage(
)
)
.filter( ( node ) => {
- const taxLabel = node.getElementsByTagName( 'th' )[ 0 ]
- .innerHTML;
+ const taxLabel =
+ node.getElementsByTagName( 'th' )[ 0 ].innerHTML;
return taxRatesEval.some(
// We need to remove the ":" on the end of the string before we compare
( taxRate ) => taxRate.name === taxLabel.slice( 0, -1 )