Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../includes
File: wc-interactivity-api-functions.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WooCommerce Interactivity API Functions
[2] Fix | Delete
*
[3] Fix | Delete
* Procedural wrappers for interactivity API shared stores.
[4] Fix | Delete
* These are experimental APIs and may change in future versions.
[5] Fix | Delete
*
[6] Fix | Delete
* @package WooCommerce\Functions
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
declare( strict_types = 1 );
[10] Fix | Delete
[11] Fix | Delete
use Automattic\WooCommerce\Blocks\SharedStores\ProductsStore;
[12] Fix | Delete
[13] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[14] Fix | Delete
exit;
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Load a product into the interactivity API state.
[19] Fix | Delete
*
[20] Fix | Delete
* This is an experimental API and may change in future versions.
[21] Fix | Delete
*
[22] Fix | Delete
* @param string $consent_statement The consent statement acknowledging this is an experimental API.
[23] Fix | Delete
* @param int $product_id The product ID to load.
[24] Fix | Delete
* @return array The product data.
[25] Fix | Delete
* @throws InvalidArgumentException If consent statement doesn't match.
[26] Fix | Delete
*/
[27] Fix | Delete
function wc_interactivity_api_load_product( string $consent_statement, int $product_id ): array {
[28] Fix | Delete
return ProductsStore::load_product( $consent_statement, $product_id );
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* Load all purchasable child products of a parent product into the interactivity API state.
[33] Fix | Delete
*
[34] Fix | Delete
* This is an experimental API and may change in future versions.
[35] Fix | Delete
*
[36] Fix | Delete
* @param string $consent_statement The consent statement acknowledging this is an experimental API.
[37] Fix | Delete
* @param int $parent_id The parent product ID.
[38] Fix | Delete
* @return array The purchasable child products keyed by ID.
[39] Fix | Delete
* @throws InvalidArgumentException If consent statement doesn't match.
[40] Fix | Delete
*/
[41] Fix | Delete
function wc_interactivity_api_load_purchasable_child_products( string $consent_statement, int $parent_id ): array {
[42] Fix | Delete
return ProductsStore::load_purchasable_child_products( $consent_statement, $parent_id );
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* Load all variations of a variable product into the interactivity API state.
[47] Fix | Delete
*
[48] Fix | Delete
* This is an experimental API and may change in future versions.
[49] Fix | Delete
*
[50] Fix | Delete
* @param string $consent_statement The consent statement acknowledging this is an experimental API.
[51] Fix | Delete
* @param int $parent_id The parent product ID.
[52] Fix | Delete
* @return array The variations keyed by ID.
[53] Fix | Delete
* @throws InvalidArgumentException If consent statement doesn't match.
[54] Fix | Delete
*/
[55] Fix | Delete
function wc_interactivity_api_load_variations( string $consent_statement, int $parent_id ): array {
[56] Fix | Delete
return ProductsStore::load_variations( $consent_statement, $parent_id );
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function