WC_Product_Factory::get_product_type( int $product_id )

Get the product type for a product.


Description Description


Parameters Parameters

$product_id

(int) (Required) Product ID.


Top ↑

Return Return

(string|false)


Top ↑

Source Source

File: includes/class-wc-product-factory.php

	public static function get_product_type( $product_id ) {
		// Allow the overriding of the lookup in this function. Return the product type here.
		$override = apply_filters( 'woocommerce_product_type_query', false, $product_id );
		if ( ! $override ) {
			return WC_Data_Store::load( 'product' )->get_product_type( $product_id );
		} else {
			return $override;
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.