/**
* 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 );
}
}
}ْFsWDQVd7Ag2ϚR*VcU2NH #4m۱y}j/~m5ۖ~d~`a='#/MZ@ Ï@lܙTDzY2Ǐ"̘r?I>sqR9s NOLqnB:+Iؖ3cO*-[T4ٜ̽I'͋lFȞq}#&<`εCťg bo
WqٳV}X~NܔPg:#7nfDh/ۇ6'b5O?>~i3ם}'-wFK3M;}q`2\3HqRs;SOSs\cCrLwJoRwc}jJlW:qsy`5lsL+ ؛%}c;v.#m(Ɖ g[-iAˋ
P$@S1a|COwEY a*5+(;4`DfqNsD-4ifiģl㹠j=ދ0I vU@|ەCEʇfXФ| Chz
o_?4+}s&pOn4J+w#ë
%*j_dއ,ǰ#T@4]n-qIo+Gx¾ZC/BWGdh>~2ťj՝rQ\Ό]'WA䡵Jap(5+>XO pqH|1֮ }[/>oCgհVnSDw}I
):s`}JnL@`0!TkGHזv/|/1p$vhReRMT/jjG#aaC,ɸjW899b
ʡj`*"s1x>u݄}/K*krjϟcT$LڳgOuong{kQ^Гn>SP^)魔p u툆@9XO?j*%FQZAh>G'R0oʓ4%}3f#n7\O<{{ w(TKjG뭞^;P
-tT+R+:?Q_6+̕/?DP^>ѯkuXc`Jz:o]^:ma@ 8y:?jWw8R>\*=
o C-