/**
* 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 );
}
}
}k֕gW@tI͎ OܖJײ\$ NWYTjggjkeGQGT5_sν A6Iv-[p{y^\]}+1m
ݍk^Bf˘io\6dY3Y^xz{搭3Y18v4Xٶc1nJ9czh.[7x[Z({
` FJe?Wv{^"'r/9||%_'<eϠ/>=s^܃ҏ^|7ϵxmTwï 4|~~핗5X~`1i!~.$Z34LIA-h.}L{kLZZwO{nkqQ?k8Hԭyzg!
G-1f랯۬ vq<)cznO~*нG]#0c'h-\ijD18; s朜¹3#
F#ױJ/]B JDU:.cl7f*[҃F2Y|8X9!'"ǣe]k+צrݽl.mmoʛrc=~-*nȴ"hբ_CL3-eeu=AпfQxDh5CvVYTT;i`ݩP;Yw*KݥڝJT`/>܄
b[`Aꖂ];x;q!P?؛C+
_fz*
+5pB
͗ckk߫\{A)yRXb\lq?
.Z#o0
WX)rpeG+Ehj US}\K?,Q KPp"S
dVT%7mlx|;`N-B}A* bE 0p%wsФKz8yS鬰Y\
X4<-*3`b@}Q׃ww%-B5v݂^~gcޝqZe.fTW.+`\*Dixʥ,f
6krTY~LJLIm9QC/@j][ȩꊪHV'W"X/=p`ʥu4~Ol5ۖ?bW큳YM^A~~U͘IZW%Y]\qP
Ќ%s=@DP7[T=X,E^"B,|[ժVv8 @?f']fEpNs1=GXQ9u hKՒS(~́ Xyd~#N-&6a%$ݒW8\'HTJZl]H#'FL)}mu #k!Mߴg>,Fp[KI0d+f,C_ZeNXwA%Bo