Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Assigned] List of product categories from a parent

$
0
0

Dear Pat,

Creating a custom shortcodes (as views is fully compatible with shortcodes) like this:

By name

function woocommerce_subcats_byid_func( $atts ) {
	extract( shortcode_atts( array(
		'parent_cat_ID' => '',
	), $atts ) );

	return woocommerce_subcats_from_parentcat_by_ID($parent_cat_ID);
}
add_shortcode( 'woocommerce_subcats_byid', 'woocommerce_subcats_byid_func' );

By ID:

function woocommerce_subcats_byname_func( $atts ) {
	extract( shortcode_atts( array(
		'parent_cat_NAME' => '',
	), $atts ) );

	return woocommerce_subcats_from_parentcat_by_NAME($parent_cat_NAME);
}
add_shortcode( 'woocommerce_subcats_byname', 'woocommerce_subcats_byname_func' );

So, you can call both: [woocommerce_subcats_byid parent_cat_ID="1"] or [woocommerce_subcats_byname name="categoryname"]

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.


Viewing all articles
Browse latest Browse all 20145

Trending Articles