Automattic\WooCommerce\Blocks\BlockTypes\AddToCartWithOptions

AddToCartWithOptions::get_template_part_pathprotectedWC 1.0

Get the template part path for a product type.

Method of the class: AddToCartWithOptions{}

Returns

String|true|false. The template part path if it exists, false otherwise.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_template_part_path( $product_type );
$product_type(string) (required)
The product type.

AddToCartWithOptions::get_template_part_path() code WC 10.5.0

protected function get_template_part_path( $product_type ) {
	if ( in_array( $product_type, array( ProductType::SIMPLE, ProductType::EXTERNAL, ProductType::VARIABLE, ProductType::GROUPED ), true ) ) {
		return Package::get_path() . 'templates/' . BlockTemplateUtils::DIRECTORY_NAMES['TEMPLATE_PARTS'] . '/' . $product_type . '-product-add-to-cart-with-options.html';
	}

	/**
	 * Experimental filter for extensions to register a block template part
	 * for a product type.
	 *
	 * @since 9.9.0
	 * @param string|boolean $template_part_path The template part path if it exists
	 * @param string $product_type The product type
	 */
	return apply_filters( '__experimental_woocommerce_' . $product_type . '_add_to_cart_with_options_block_template_part', false, $product_type );
}