15 1 0 4000 1 https://codeblock.co.za 300 true 0
theme-sticky-logo-alt

is_type()

0 Comments

Framework / CMS

WooCommerce [Version: Since 3.0.0]

Syntax

Typical Usage

returns the WooCommerce product type. eg,  simple, variable, etc.

Accepted Parameters

  • type (string or array) (Required): A string or an array of types to check. Use a string to check for a single type or an array to check for multiple types.

Return Value(s)

Returns a boolean value.

Notes

Backwards compatibility is available to check for types of downloadable and virtual although newer methods have been added for those. See is_virtual() and is_downloadable().

Examples of is_type()

Example 1

<?php
$product = wc_get_product(1234);
if ( $product->is_type('variable') ) {
    // Do Something
} 

Was This Helpful?

Previous Post
wc_get_product()
Next Post
get_available_variations()

0 Comments

Leave a Reply