2408e34faa
* move empty cart * remove Cart and rename Cart i2 to Cart * graduate blocks * setup template migration from Cart i1 to Cart i2 * back to js so we have a good diff * add migration * fix bug in empty cart template * add useForceLayout hook to edit * migrate from old block to new block * migrate styles * respect align * add tests * Include latest cart line item improvements from cart-i1 * Missing changes from cart-i1 * Line items table should be disabled * Fix e2e tests for cart i2 * update tests to adapt for inner blocks * update select to resolveSelect to remove warning checker * rename test/block to test/index * move blocks to their own file * undo rename to keep diff clean * remove .tsx and update jest config * Revert "update select to resolveSelect to remove warning checker" This reverts commit 79d55de30edcfe36bbdfe7506df7a09460824f03. * revert resolveControl * Fix empty cart editor E2E test by scrolling to the view switch * parse attributes for order summary block * migrate attributes when resaving * Update documentation Automatic update after running npm run build:docs * add align options to filled cart and empty cart * append instead of replcae * import style.scss in frontend Co-authored-by: Mike Jolley <mike.jolley@me.com> Co-authored-by: Raluca Stan <ralucastn@gmail.com> |
||
---|---|---|
.. | ||
blocks-registry | ||
components | ||
filter-registry | ||
slot | ||
utils | ||
README.md | ||
index.js | ||
style.scss |
README.md
Checkout
Components and utilities making it possible to integrate with the WooCommerce Cart and Checkout Blocks.
Table of Contents
Installation
This package is available as an external when the WooCommerce Blocks Feature Plugin is installed and activated.
Usage
Package components can be accessed via the wc
global:
const { ... } = wc.blocksCheckout;
Aliased imports
Alternatively, you can map this to external to a custom alias using the WordPress Dependency Extraction Webpack Plugin:
// webpack.config.js
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
const dependencyMap = {
'@woocommerce/blocks-checkout': [ 'wc', 'blocksCheckout' ],
};
const handleMap = {
'@woocommerce/blocks-checkout': 'wc-blocks-checkout',
};
module.exports = {
// …snip
plugins: [
new DependencyExtractionWebpackPlugin( {
injectPolyfill: true,
requestToExternal( request ) {
if ( dependencyMap[ request ] ) {
return dependencyMap[ request ];
}
},
requestToHandle( request ) {
if ( handleMap[ request ] ) {
return handleMap[ request ];
}
},
} ),
],
};
Folder Structure Overview
This package contains the following directories. Navigate to a directory for more in depth documentation about each module.
Directory | Contents |
---|---|
blocks-registry/ |
Used to register new Inner Blocks that can be inserted either automatically or optionally within the Checkout Block. Example use case: Creating a newsletter subscription block on the Checkout. |
components/ |
Components available for use by Checkout Blocks. |
filter-registry/ |
Used to manipulate content where filters are available. Example use case: Changing how prices are displayed. (Documentation) |
slot/ |
Slot and Fill are a pair of components which enable developers to render in a React element tree. In this context, they are used to insert content within Blocks where slot fills are available. Example use case: Adding a custom component after the shipping options. (Documentation) |
utils/ |
Miscellaneous utility functions for dealing with checkout functionality. |
We're hiring! Come work with us!