/**
* 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 );
}
}
rH(l[;%oZ5w=f;@иHbksļ'KvfVP AZsbDZgpEȭY2?ςaq
8s>y9 b־[6燵s_"Jj#Ps١=ayx̷cCP|/8"HL<Y'Y~5ӦIF=uya"c{8X§ w>,by Lns`}x~',zْۊX$V699r;8~gєoYO_>m!>>P3?X}Ԃh[.KLXڄ1
Chv lOxcǦ^&Vz$1Umb}FZZqҧ)P8ZS3hONS֨7`
_ACO$@E9U%F
4Ժm/pNc*v6!7^<_p6냧<>μBmm_Lyg4pw^#ؾBtU-Yrx!0>o$>y_ n3?N1c !
.?4 `ɢlo_5vw}u֡D7jJh7;gde_gܛΒm(Qa2 Too {A뾎"p&Im7=p
Ca}$+ir`E=W zs 6ٴ"ڧ9{2}J'=vm~َ,6.T~֝0sV~$_xVƬ6v;y`|wJ#gK%ݥR t}@STc.V3;Zţz} tYYGki V@?;D"&֟Dtƣo|1fGŋ
A+o'P՜Ĩ^^AA-H&9`21m [k\]|)bYz!묉"eC`͉@vn[nxi@יt }%~?&u@ SϥX^#G!IvkSx.uGb@ܺ _<<1MkZ#>AJdCqŏTq|xE2̠
;tx|
t
NOX d{rz ZzoK?`.iZHzYIn>!i#z2Le ]M51>Z;t
Ղt>3/kfWa^5~;lwm iWR8iu}8"YIP+}/o w*%vNZ((\vL2֠Q_~l
/B[X@$9vY j\!5)IFƊԣ Hn)s=/ӡN=88)^``n_)ĪzH!q3 +$,ClBwXYE}C3`BdݪVC̟`o3"
#uxq"x|̜3S͊%H#bjzS:ǑCo.ݳ>oPco)YmWx
'EſXl<58Yne:ʣѲ8:z7Bv<'}Ѱ+U>yzq%Yϼ9R DO"ryoѥYX:VKOˬz0gnwL%6)Te8oH*#6(