WordPress at Your Fingertips
function is not described

WC_Product_Data_Store_CPT::get_shipping_class_id_by_slug() public WC 3.0.0

Get shipping class ID by slug.

{} It's a method of the class: WC_Product_Data_Store_CPT{}

No Hooks.

Return

Int|false.

Usage

$WC_Product_Data_Store_CPT = new WC_Product_Data_Store_CPT();
$WC_Product_Data_Store_CPT->get_shipping_class_id_by_slug( $slug );
$slug(string) (required)
Product shipping class slug.

Changelog

Since 3.0.0 Introduced.

Code of WC_Product_Data_Store_CPT::get_shipping_class_id_by_slug() WC 5.8.0

public function get_shipping_class_id_by_slug( $slug ) {
	$shipping_class_term = get_term_by( 'slug', $slug, 'product_shipping_class' );
	if ( $shipping_class_term ) {
		return $shipping_class_term->term_id;
	} else {
		return false;
	}
}