/**
* 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!I"H <`jHU{Ke $ &ff0k'8 yUwu "=<<<8}bV
s)a.Ú/k&}\ĜY3F"~6a|/[:v<±F/
xNpW,AP\;gp '+jlɰ6 :n`irY(vbWu>_zϾF$b/-Mٷ>{%?rbEu|%QY9~OyxڒX*zc?jThA(
.‵?>}iߟ}S{3d{L39 bfkքG+&܍@(<_D,t<_61[ V/짟Ow-LRڳwPG%nY`0Rk@q6TK\N1Pu,;
˹P$db¾ڕewfMXM˟&UCO/1ڏK~ bWެ^BE
q Qa5b1ϒ(Y-1?;D0#«ژGЭ+>>է;ZTS6fSo^OZ&.c()D
EhU
T"+/Skhg}(i !ܜ;^sՅfi֮O~}9Кצ!ZLTw* 5Iά8}W"壈X4bgO|=d aݤ~x}M0b*>|mΙ5pÚ!}PHhZP{au7{u&,>CvDV <.S [h&-w;M$"X zڮ+QÌACn$6qv
"ڧ=h[{2iZL>0u݆=ޗ)ƅl_=1{nʟ$\gϞ)qGV{6sܳ/դe.k)ݵ><&PAA6f3{)ƸVi>^+FꓤձS@?(O؏~x.o\g"NfYYByn2U-&$x
E5)ɵ(/шQ3Zj }{0y/ﮎׇ
XM${9:k%{m_s^?q7pd|Tk+nF56ɐ>N&³_׆u]?w"`n=x>H]'#J*~nxMxeE
x_CAd]CS,pܶ__@:Q#Dw/U61KP3\K,iJ6|!i =zid2gRϠVkÄOҚNs9靁5vJ>578%:qu" t$yc/J:߿}~)hĪ//f쮁F/'@Cn$T"^~n~ej0"ezP
i8al}P!?{cFɊzE]a
]cn}o.4˰UB
Ψ B0 T[\bI=j,s3 )@Wԩc0p0f醕Ϟ7dw~B[U"%؇'w$ :@m>1-Ǘu:|Fz-R^B
ZX2P͜IUY~x,cxR=1zCIIsdz]
۷Ó9_>WhtÃXLy4+?~̧R`_);zD 3Y=q?-c.hƁx