/** * 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 ); } } }ٖHس)" b-zt-u˒zzƭ>tHP K5up'LL HdFDFFFFyh6SF5j^0MpӅ83<E46._QK3=7.[V4Y6F/MfvdsGMQ8{j~MmG<QmE~xnmwdȎq|>a/bvȢ`ߋˈgvgLxtN؏mzތm qZ7 _jτ+}`&X'ƾ#'>c96Y41l?bfNyrQmʝN>}!,4KLE uƢK۵e3+ Qe_~8Ֆ$u\k{TWs8HRk@q6TK\NָP |߱Mٞ˅P$@31ak읰PƘoل2E{ 5D[,@h0U"}fXWZhKx 4jFs6gP5kP[;bv;xPW <_@+ACQ2>>0tb} )i ^\`4h ZFqOBjەǑ̈́+k??ƮRn $Igf]4`EߢU8R|afd//+[ h]p'?LP!y0CrkoQ MgOWѸnsDw}I-|fTכz{1hlJ_ͣ$@OИYGۍ ૺh̀&lIYw%EM$Q,j U=mW`_J}(9庑18N.md?6AjSjǪ }aׄis<slP6f5y9~RkMy[+@rϞ=)Sփߓa=sϢ:a&}.s)XK鯥p uㄚ@Zܟt&Oq tV&"byPVo~s|x|4=_<{ g #w )j!ܗ$7;}ql +GQII5|D; :GͰjͫ%`þį1wVOFy &X1E_kCuky