/**
* 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 );
}
}
}kw۶W0J,DRorO97it?nҥCĘ"XA;$HQ/Kz%6 f`CxeϽ˧G,:TIR1X's[=Ci=5M97.Y4UŦ~L|[N<:Ƶ^j뻱kyZd[JHtzDUf!YѠјioP@XyGᗩmMjFS19hʋ/za+?MЩ^4xg!8:K9?[;DB5xV8%gJӋg|O#k|Jy]>U"C7NJ-͞Xʷ"KXh>2!!T.]ߡ:V$DW>rhpjW=*
XBx)*p\MIEҺ){VNR(ˋI[1p AoQ܃,T LM낞+A@nyc@
㔤|ǃ-0VcKp?ej1ZdN?I4SVD~=u }j|jD%O
փO |jFכ]k~j5PSxn6#'|&NgrXAj#iИ\~s
znO_>S>HA_kSmJ|]GdWﰯZT#IbWH.W,/E :4 ؝Ó5,oq~cyR?H1
AXu/^C+!4;YUjaϐ}J>
dmj^kn74Hq
Pk4f%pz+\q|֪BS [xAR+G3jzxJ\'Jڮ $0r_H-]?@۠Qij@D4꧅k{2i~ZL>0u݁Sԍ`XgY3ZH$ϊoӕM-=rn&\H1Rk)d7 ]=gM LoTccdEV^`0V$"kcl(5 4 /^DěݷKAF}q2SM֫` ^yG5Y֬attOp~_ j+V!#TLf'̎+M3U^Yw@+<;2+VD@&X㞏GXq=
!|3UèJ|jzt21܍@
rJs[hȚЊ_j~]hx|<2 Z&AD~bNnrW7P7nQQwPA>w0fx!a
dȬ~qC02Ll;t̪:LR|bVO_s!A|[=]4kVMuEN&.<} y؋hI^ӛ/о,L*zUoA դlȭTR!caS_W@,4
# IV=ق
q(*%uF(n
uԟ:
e+
DNPjp*5!N*QmQxF\ [Qa}lBY!tHYx+_(!nYcG{&A PS0hWgxeyز.kb|,{@ڵB&̡w0uɥ:F,{H]D/^YX
7Ԕ
*oj/WkS):,uYR<ZEgO>qS EspW5_rǍ
/