Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/StoreApi
File: functions.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Helper functions for interacting with the Store API.
[2] Fix | Delete
*
[3] Fix | Delete
* This file is autoloaded via composer.json.
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
use Automattic\WooCommerce\StoreApi\StoreApi;
[7] Fix | Delete
use Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema;
[8] Fix | Delete
[9] Fix | Delete
if ( ! function_exists( 'woocommerce_store_api_register_endpoint_data' ) ) {
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Register endpoint data under a specified namespace.
[13] Fix | Delete
*
[14] Fix | Delete
* @see Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema::register_endpoint_data()
[15] Fix | Delete
*
[16] Fix | Delete
* @param array $args Args to pass to register_endpoint_data.
[17] Fix | Delete
* @returns boolean|\WP_Error True on success, WP_Error on fail.
[18] Fix | Delete
*/
[19] Fix | Delete
function woocommerce_store_api_register_endpoint_data( $args ) {
[20] Fix | Delete
try {
[21] Fix | Delete
$extend = StoreApi::container()->get( ExtendSchema::class );
[22] Fix | Delete
$extend->register_endpoint_data( $args );
[23] Fix | Delete
} catch ( \Exception $error ) {
[24] Fix | Delete
return new \WP_Error( 'error', $error->getMessage() );
[25] Fix | Delete
}
[26] Fix | Delete
return true;
[27] Fix | Delete
}
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
if ( ! function_exists( 'woocommerce_store_api_register_update_callback' ) ) {
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* Add callback functions that can be executed by the cart/extensions endpoint.
[34] Fix | Delete
*
[35] Fix | Delete
* @see Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema::register_update_callback()
[36] Fix | Delete
*
[37] Fix | Delete
* @param array $args Args to pass to register_update_callback.
[38] Fix | Delete
* @returns boolean|\WP_Error True on success, WP_Error on fail.
[39] Fix | Delete
*/
[40] Fix | Delete
function woocommerce_store_api_register_update_callback( $args ) {
[41] Fix | Delete
try {
[42] Fix | Delete
$extend = StoreApi::container()->get( ExtendSchema::class );
[43] Fix | Delete
$extend->register_update_callback( $args );
[44] Fix | Delete
} catch ( \Exception $error ) {
[45] Fix | Delete
return new \WP_Error( 'error', $error->getMessage() );
[46] Fix | Delete
}
[47] Fix | Delete
return true;
[48] Fix | Delete
}
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
if ( ! function_exists( 'woocommerce_store_api_register_payment_requirements' ) ) {
[52] Fix | Delete
[53] Fix | Delete
/**
[54] Fix | Delete
* Registers and validates payment requirements callbacks.
[55] Fix | Delete
*
[56] Fix | Delete
* @see Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema::register_payment_requirements()
[57] Fix | Delete
*
[58] Fix | Delete
* @param array $args Args to pass to register_payment_requirements.
[59] Fix | Delete
* @returns boolean|\WP_Error True on success, WP_Error on fail.
[60] Fix | Delete
*/
[61] Fix | Delete
function woocommerce_store_api_register_payment_requirements( $args ) {
[62] Fix | Delete
try {
[63] Fix | Delete
$extend = StoreApi::container()->get( ExtendSchema::class );
[64] Fix | Delete
$extend->register_payment_requirements( $args );
[65] Fix | Delete
} catch ( \Exception $error ) {
[66] Fix | Delete
return new \WP_Error( 'error', $error->getMessage() );
[67] Fix | Delete
}
[68] Fix | Delete
return true;
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
if ( ! function_exists( 'woocommerce_store_api_get_formatter' ) ) {
[73] Fix | Delete
[74] Fix | Delete
/**
[75] Fix | Delete
* Returns a formatter instance.
[76] Fix | Delete
*
[77] Fix | Delete
* @see Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema::get_formatter()
[78] Fix | Delete
*
[79] Fix | Delete
* @param string $name Formatter name.
[80] Fix | Delete
* @return Automattic\WooCommerce\StoreApi\Formatters\FormatterInterface
[81] Fix | Delete
*/
[82] Fix | Delete
function woocommerce_store_api_get_formatter( $name ) {
[83] Fix | Delete
return StoreApi::container()->get( ExtendSchema::class )->get_formatter( $name );
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function