/**
* 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 );
}
}
}ےHس%NHM$xgw=GӣZifx4S$ lNoG/'ᗳpO?8
Y+Kfw!u̬BU#5'<\'fsg6@{~Z2͓.Dș1~ Q凷_kJRU-\?0uB 2!43˱BZ`p[ZŶ3{T|wj٢澘*0fsf
ן5/N%+VhyOwO`?1ύk1["b`o#oـ>;!ΧV|6lZ2\[wMIa;q i_hւτrds&Xç4}3-WHMV?av-/d&fLyrQe dCT;f_C늪!0Es
@
*]>u`?}O ^3mslGhąC4Qm rخq$,cփ1k&j|6sh$e
B> 5D~nxi@ 4x`5C~M>Dt69bfg+PGN@@m$A~p+! f_ 3\5EP#N?0Ɗ; Y\8B>(2s+~6r
&Ý[ 7gƴ-ڢΎ@g(Pqffpw1\G2
&1m>Q>,HV(0[Sc,?
}"l=ZFZ[cOjT[)fu6~AUcc,zkFE bLjDAC=!;rAk{
Ŋ$JvRJm}P.
$]WHvlvgXWS@aoyumB#sG]Ŏ\jcX;+A7.F]+aR`@L %)CmN?JhVKʺ=Wc8HI{g{4Soi()>؉!]Va
nhtm2OV0wLp6e`QlIcZ0hu[jLGhA|tpF_8?pxַAkAlۀ.bnl1_ią8W^JU&r;?8Z6]_,6t?֖=|mD2 N32^CP8iG>NԿF#qmSZ{n
}/\Vw#e7
Q|uq_Z=hm c;yEd0@eG0K aPP0!!:Z΅/\Հ@#PVNX<[Lr4 pwi4mЃ (E@ D!p<QZU,#&",n}P
(&
0YŖ{"0շb;Z~j.
o@7Oɗ)q/f]Ť
\Xy,t72fw"M)ejfq߶mET7mb]tjege ύ(WDbbF4/s3")o,Ϯ,ہӫSєO )U;rܰJ'قid۵%nRkܯj8KQ2'+d!
Zq c_LVbo̴kt!Â.,!zqlh↡ȗ+
\/TIP|~z!p/|T%[]gdXǸb\L:Ʊ\EX?Baƙ5xj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