WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

wc_get_product() WC 2.2.0

Main function for returning products, uses the WC_Product_Factory class.

This function should only be called after 'init' action is finished, as there might be taxonomies that are getting registered during the init action.

Хуков нет.




wc_get_product( $the_product, $deprecated );
Post object or post ID of the product.
Previously used to pass arguments to the factory, e.g. to force a type.

Список изменений

С версии 2.2.0 Введена.

Код wc_get_product() WC 5.0.0

function wc_get_product( $the_product = false, $deprecated = array() ) {
	if ( ! did_action( 'woocommerce_init' ) || ! did_action( 'woocommerce_after_register_taxonomy' ) || ! did_action( 'woocommerce_after_register_post_type' ) ) {
		/* translators: 1: wc_get_product 2: woocommerce_init 3: woocommerce_after_register_taxonomy 4: woocommerce_after_register_post_type */
		wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%1$s should not be called before the %2$s, %3$s and %4$s actions have finished.', 'woocommerce' ), 'wc_get_product', 'woocommerce_init', 'woocommerce_after_register_taxonomy', 'woocommerce_after_register_post_type' ), '3.9' );
		return false;
	if ( ! empty( $deprecated ) ) {
		wc_deprecated_argument( 'args', '3.0', 'Passing args to wc_get_product is deprecated. If you need to force a type, construct the product class directly.' );
	return WC()->product_factory->get_product( $the_product, $deprecated );