/**
* 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%:f >RKuFls,O(Antĉ}݈}}؈?_̬o>3!u̬̬BU-lܛTDh:`GsqfMyA%)\TeU%HxPo%1s"FhqW4 x3r츢¦TQ䇇dO24.^EN}vCǓ }=ۙC&<L\ʀ\9L#W̡Vy~Ko
q{@F^ҽ909vDO}#J蒽0N39#f֘uRs7&PB_atx\ֱ~){RZ?_~=5SE+Beyp5\sL+ ؛%}c;v.#u܍D(FwGA~y1w*&Y[#5(7jª[rCF>Q9qFk?17ϨoXЈBc3g'/ˈX9
O{E>ٻx(~ʡcc#/8}l1?A?6ݺYol[FVnAC_)prXrxUCcGr\X]؈SH ¯EpҫS'dhHi ^xY(?U_ZXGq9b*
.Ytr.|F>0
E-rpaK ϹߏGѕH:OUYW _Vk5Et z
84Qfͬ=9M\T8ikf5 RE UQ M8@;4ٶZpRMT/j-EuBpYMطACmPYQ|R9
L-=?.\Lӆ=W%Fj_=i>ɃSPZ)鮔p
6
j2=ZpUJk
8uTल`w<0ONpncf"ƕ#/=;ݳJ|xZ6Zk:u(L{T(II(GeWjWKЕ:-{yļޯɓ*c$a_X[3Mny , NP8yWIT5A)"|
j>a` C><1kN]:L³Ϧkb]] ṊJW)a4ךWצ8<"XTK^]XȺ 1XԹm:~qgjoϔ/Frh\%hZ)~y'II:}>)0geθZO`V+'1Co1㙖ՓW2gj|3;0+Im?lifrmuDP$yҒgE)o=_Z'ک_[`4pZr\{r_V,:5?skt*H A,GUРpXAl|!רXQZҗj_ 4 ٭ TϥcKota=9),
nA^3CUհwh*Rcb?U8BO`=UgrkJ薵Hb {dj S0h/O4.3#nͲh^5EJЖ?UHa\{Bfq=KE]GϞYX*w()I}WxfKk&