woocommerce/plugins/woocommerce-blocks/packages/checkout/utils
Thomas Roberts eea5ea3aad Prevent error when entering postcode for countries without specific validation rules (https://github.com/woocommerce/woocommerce-blocks/pull/8987)
* Allow countries not covered by postcode-validator to pass validaiton

* Add "skipPushCheck" option when filling billing and shipping details

* Allow albania as a shipping/selling country

* Add test to ensure adding a postcode for a country without rules works

* Remove skipPushCheck option

no longer needed
2023-04-10 03:13:23 -07:00
..
validation Prevent error when entering postcode for countries without specific validation rules (https://github.com/woocommerce/woocommerce-blocks/pull/8987) 2023-04-10 03:13:23 -07:00
README.md Correct broken *.md links (https://github.com/woocommerce/woocommerce-blocks/pull/7108) 2022-09-12 11:29:24 +07:00
extension-cart-update.ts Simplify @woocommerce/types imports (https://github.com/woocommerce/woocommerce-blocks/pull/8019) 2022-12-23 18:59:02 +07:00
index.js Add cart/extensions endpoint to allow third party extensions to process server-side and get a new cart (https://github.com/woocommerce/woocommerce-blocks/pull/4298) 2021-06-07 12:16:47 +03:00

README.md

Utilities

Table of Contents

Miscellaneous utility functions for dealing with checkout functionality.

extensionCartUpdate

When executed, this will call the cart/extensions REST API endpoint. The new cart is then received into the client-side store.

Usage

// Aliased import
import { extensionCartUpdate } from '@woocommerce/blocks-checkout';

// Global import
// const { extensionCartUpdate } = wc.blocksCheckout;

extensionCartUpdate( {
	namespace: 'extension-unique-namespace',
	data: {
		key: 'value',
	},
} );

Options

The following options are available:

args (object, required)

Args to pass to the Rest API endpoint. This can contain data and a namespace to trigger extension specific functionality on the server-side. You can read more about this, and the server-side implementation, in this doc.

mustContain

Ensures that a given value contains a string, or throws an error.

Usage

// Aliased import
import { mustContain } from '@woocommerce/blocks-checkout';

// Global import
// const { mustContain } = wc.blocksCheckout;

mustContain( 'This is a string containing a <price />', '<price />' ); // This will not throw an error
mustContain( 'This is a string', '<price />' ); // This will throw an error

Options

The following options are available:

value (string, required)

Value being checked. Must be a string.

requiredValue (string, required)

What value must contain. If this is not found within value, and error will be thrown.


We're hiring! Come work with us!

🐞 Found a mistake, or have a suggestion? Leave feedback about this document here.