WC_Product_Data_Store_CPT::get_shipping_class_id_by_slug( string $slug )

Get shipping class ID by slug.


Description Description


Parameters Parameters

$slug

(Required) Product shipping class slug.


Top ↑

Return Return

(int|false)


Top ↑

Source Source

File: includes/data-stores/class-wc-product-data-store-cpt.php

	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;
		}
	}

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.