Skip Navigation

[Resolved] Woocommerce Views – In cart filter?

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 6 replies, has 2 voices.

Last updated by thomasS-11 6 years, 10 months ago.

Assigned support staff: Luo Yang.


So i was wondering.. i have a possibility to Query filter by "On sale" "In stock" and "Price" .. How comes you didnt make 1 for "In cart" ? it's pretty usefull when you are making a ecommerce..

Further more, how do i create a "Other clients who bought this, also bought:" ?



further more.. most standard WooCommerce fields arent even included in WooCommerce views..
Creating a single-product template, i cannot include the product SKU, TITLE, DESCRIPTION etc..

If you ask me, that is some of the most important things to include in such a plugin..
This plugin doesnt really fit the needs to create a eCommerce .. its really lacky at many points..

WP-Types claims that you can build websites all codefree, but that is absolutely not true..

Please tell me how to include SKU, description, title (i just went with [wpv-post-title]) and if its not included in the plugin, please consider including it!..

When is the beta releasing?


Luo Yang

Languages: English (English ) Chinese (Simplified) (įŽ€äŊ“中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

1) Q: In cart filter
It is possible with Views filter hook wpv_filter_query,

Woocommerce is using PHP Cookies to store the in cart product information, you can try retrieve the products IDs from the Cookies the pass it to your View using wpv_filter_query

More help:

2) how to include SKU, description, title

For SKU field, it is using field slug "_sku", which is a hidden field, you can display it with Views shortcode wpv-post-field, like this:
[wpv-post-field name=??_sku??]

For description and title, you will need install Views plugin and try the shortcode:



Hi Luoy.

Thanks for assisting me again 🙂

More help: thank you, but i cant seem to find out how to display those in the cart only..

2) Could you please include the SKU in WooCommerce views as a standard feature? It would be easier for future eCommerce's to be developed in case of forgetting this special shortcode.. Further more it's not mentioned anywhere i think.. I had to make a support request for this to know the shortcode - you should consider including it as a standard to WooCommerce Views.., i think all default WooCommerce fields should be a standard feature of WooCommerce Views - Consider this a feedback for your devs 🙂 ..
- BUT Thank you very much for the shortcode, just what i needed!

3) i already have Views installed but i can't see the default views field.. maybe its currupted because i can see all my views and they work, but i dont get the default views fields when i click the "Views" / "Fields" button in the HTML / Output editor in Views, OR in Content Template editor when i click the button..


Also, i would really like to know how to create the product page? not the single product, but the page with all products listed.. i tried chosing content template for products and product categories but they dont display?

Is it possible to create a custom product "archive" like the default page that comes with WooCommerce?


Luo Yang

Languages: English (English ) Chinese (Simplified) (įŽ€äŊ“中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)


1) Q: In cart filter
Please try this:
a) You can create a view, see above sreenshot In-cart-filter.png
filter with:
Include only posts with IDs is set by the View shortcode attribute "ids" eg. [wpv-view name="view-name" ids="1"]

b) Add below codes in your theme/functions.php:

add_shortcode('in_cart', 'in_cart_func');
function in_cart_func($atts, $content){
	global $woocommerce;
	$in_cart = $woocommerce->cart->get_cart();
	$arr = array();
	foreach($in_cart as $k => $v){
		$arr[] = $v['product_id'];
	return $res = implode(',', $arr);

It will be able to create a custom shortcode output products IDs as 123, 456,

c) Goto your WP admin side, Views-> Settings, in section "Third-party shortcode arguments", add above shortcode name "in_cart"

d) create a page place above view as below:
[wpv-view name="In cart filter" ids="[in_cart]"]

2) Q: Could you please include the SKU in WooCommerce views as a standard feature?
OK, I put it into our to-do list as a feature request, our developers will take care of it.

3) Q: i already have Views installed but i can't see the default views field
I can not duplicate same problem, Please try this:
a) deactivate other plugins and switch to wordpress default theme, and test again
b) enable wordpress debug mode, repeat the actions you mentioned above, and post the debug logs here.

4) The woocommerce products list page is an archive page of post type "products", I suggest you try wordpress archive to custom it's customize it's layout
More help:
Customizing Archive Pages with WordPress Archives

And it would help other user find the answer if you create different thread for each question, thanks


1) Awesome, thanks alot.. eventhough i dont understand the code, im sure it works.

2) Thank you very much for taking client feedback.

3) It happened during a website moving, but i re-exported and re-imported the database and it worked.. the error was not on WP-Views end.

4) Thank you, i have created another thread for this topic, wher i ask the question again but with a solution and some other related question.