/**
* 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%:&mk_:.Αl$gr@D l
pic6bO63p%x̆nPYJ<|f=}xkza,}ɜG&ffhX+mPI=s·s/}Df /[:v4ܱF7uxN䘮Zˇ-:;8.Y',ٜiCkdȉ\~:d\wCtǙ3m@c'9͞|10ZcX}+fpҔ ftGsBsk~GLk>|xH7BL]>Sf+/>d$ǏmFfMpYtC7,95Oh6 :Mge+1W<@~c?|ljJl=:qWkHW+@q7%TK\FL7gF@1 XfWsHb/q^Abz3ƭ% TjVP8s14`Dz]pB-O8phKePh lwcPr4Z|.>;x94 ͐#EƧfX$?/I?5[݆hjYWE7|z3xАߗ \X]VQ">5>pr6bR`9t1w)lkFaG cE$)x xme³PJNݫ]rzXq9v+z
/ÅGFG̹T ƹ.j8a`>D" f5`y
]?F0tdUj+5CtWW z
84ް{nEUMwk#f5zXv ,U7@$n,X#wEM8"X j2ڥzȇaSU-e"fptPL\sZ9R
L-=?-&\|Znٗ%ƹjZG`퉙nW$Lړ'uo\n暗zIg*JZ
Piic驍Ռ^qk\)y4VjW
B+I<`~w<⏆8 Qg<c` ?yrwgVyds9 jVW9
(8mT+R+9PQ1Jr