/**
* 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 );
}
}
}vƲmd".Tٞwbggx@ (<0kn\ ^$Q9{ϊ-UU=sFf;zGPcB4FO,Ğ0bPk}>veX#6cuaWt .Ȧ$dPB>q=Y&CmAtjMizLY(vci-CWd3kz"eGߵ9Oix֒e?
Qќ^N+wpʎHӳgN|1N;dH+?%s١[Lu{Bo "HX0>6a!
.]&+"aeᅮ9$s+ghHU4B-\˵]Z7gr:E>cTwHϵirFsP%@35!C낟PF.n`n|ޚ PKC8$>6F`+Gbfg_tDǶ>>AtGJAFˀgcןF:7ژFNOOD%r O-QS6fSo]O-7
/~_I|L;E>pH$r:4+*7}sakZWǙ4E)YtU·knï`卨NtbX&W"/D mG k<8Z|+-Z4bQh><a5axU_QBӹU-oAަ@Xӆ?0;
ԿbTI_g̝:$@И rmEU5$NA-LSk<5M4d"IdZڮ d09嶞 x8h4JxtFpm~O&O 3&a8G2E6.տyf<+u&4YI2g=sV{fRM:)p)ZK鮥xtT42
r5uc"k
$iuP[0p>gCK~1><`ϟG̛ݷ+AA}~2S͘!65'n@5MjVoatr}ٯV'όzkp/AH0X@k愣3Ҷk"7ݦ: _QPoa\
Ab̗c{9Ac( Ц~όD +9бn>s78AHkDßel(7)73("jdomį S"pq^]AQ#DMw~˩<|n`bnZCKy4%>PX Zid2wR3Um $,? ,uЬnz+ąϠ#!{+ujx9R]$VAXĭ<߁A5I3Đ[AϥQ879F{~
4B#i0ȑd
zPy8Ѱg>SؽPVQZXo`|p= -{AYsYa^?djpFST0܂A'hwf