/**
* Helper functions for interacting with the Store API.
*
* This file is autoloaded via composer.json.
*/
use Automattic\WooCommerce\StoreApi\StoreApi;
use Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema;
if ( ! function_exists( 'woocommerce_store_api_register_endpoint_data' ) ) {
/**
* Register endpoint data under a specified namespace.
*
* @see Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema::register_endpoint_data()
*
* @param array $args Args to pass to register_endpoint_data.
* @returns boolean|\WP_Error True on success, WP_Error on fail.
*/
function woocommerce_store_api_register_endpoint_data( $args ) {
try {
$extend = StoreApi::container()->get( ExtendSchema::class );
$extend->register_endpoint_data( $args );
} catch ( \Exception $error ) {
return new \WP_Error( 'error', $error->getMessage() );
}
return true;
}
}
if ( ! function_exists( 'woocommerce_store_api_register_update_callback' ) ) {
/**
* Add callback functions that can be executed by the cart/extensions endpoint.
*
* @see Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema::register_update_callback()
*
* @param array $args Args to pass to register_update_callback.
* @returns boolean|\WP_Error True on success, WP_Error on fail.
*/
function woocommerce_store_api_register_update_callback( $args ) {
try {
$extend = StoreApi::container()->get( ExtendSchema::class );
$extend->register_update_callback( $args );
} catch ( \Exception $error ) {
return new \WP_Error( 'error', $error->getMessage() );
}
return true;
}
}
if ( ! function_exists( 'woocommerce_store_api_register_payment_requirements' ) ) {
/**
* Registers and validates payment requirements callbacks.
*
* @see Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema::register_payment_requirements()
*
* @param array $args Args to pass to register_payment_requirements.
* @returns boolean|\WP_Error True on success, WP_Error on fail.
*/
function woocommerce_store_api_register_payment_requirements( $args ) {
try {
$extend = StoreApi::container()->get( ExtendSchema::class );
$extend->register_payment_requirements( $args );
} catch ( \Exception $error ) {
return new \WP_Error( 'error', $error->getMessage() );
}
return true;
}
}
if ( ! function_exists( 'woocommerce_store_api_get_formatter' ) ) {
/**
* Returns a formatter instance.
*
* @see Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema::get_formatter()
*
* @param string $name Formatter name.
* @return Automattic\WooCommerce\StoreApi\Formatters\FormatterInterface
*/
function woocommerce_store_api_get_formatter( $name ) {
return StoreApi::container()->get( ExtendSchema::class )->get_formatter( $name );
}
}
}ۖF)HE uaydk,ݳ' $I@ buN˞IFD&/Ut:RȈDf33/,;Os;VD`'gsqfxhXڠ|.+[,}/*HPni[lh+ԙڑ-4#-%37Qa@LYI9ӆLْ";r+G^9|c߹V}/fF/g:e?{S5%؋£)Gs~s>lÃ8bOϞi`1CɀWݿgvYh1G\3'<\2N
Dz%&"bեZ4Ob?|
iJl璺W=q\p%sL+ ؚ%mc{6.#a܉D(FwlG60z@z*&EYxkh]Q>Xnń0ysCsp?LUȻ\| y.h 6.fs^DNCʘ(accx8M6Fco\J"#)W
߽E`MU/rcskk:}
)iܘnSŕFaTnoO6}!C/_D6 ~|lpM]wk78zXq:3v+ʋ7iD#{O|T]d_Z;ݤZ=
E/UFt=YUZamޯ$M4Lhj0^+AO:t Z|άFP\ ?n6^_UEc
4aO|Фj`X} M.T?5@DeQCIj7*SZEpi# U8|Z9QLM=?.&B|\n˔b\Z'` <+, $Sų"e=3F湛yt
c-"vԵSddZja1pWJ*v ^Ľ"V.oR8ޘ;M/^5K|dZzN$x+)ɕZ4`pTRYXԯ;gm
&X:oL<4K{چ^`dt W<'0 OKűFFC`hL3n7дn+\bf;26sX^ڰR?YWRsm(UohG3,oMG_CEd]]Ss,ܲ^]Aa3Dwo/}9KP7J,rIJ:}!i}jaf32{RxOV+ØOL+2%>靁5ЍVKd%bp*ҼqҒ@)/o^_J#)0k)+FojI#Ӕ[}^
pX/2e~'v P:3 QVao
'
774@vQK:~<ۂs٦aVͪ;jrFQX0݂fNa}Qٍh&ܠ ]Q:Z:`
t
KS_կEF:x!ص{)BKA6^
-8cn^fz~)"-'OBV? |#cRyNDCy/^ZX*So()IHVQ