Skip Navigation

[Resolved] how can show products in map after I added them in cart

This support ticket is created 3 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 3 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#1875027

how can show products in map after I added them in cart?

#1875201

Hello,

Please elaborate the questions with more details:
Are you going to use Views to query product posts which are in user's cart?

If it is, there isn't such kind of built-in feature within Toolset plugins, you might consider custom codes, for example:
https://stackoverflow.com/questions/28576667/get-cart-item-name-quantity-all-details-woocommerce

For your reference.

#1875489

hi, thanks for you time,
I am not sure if i will go to use Views to query product posts which are in user's cart, but if with views I can show on a map to my user all products he added to cart it is ok for me.
I want give you more details:
the products are locations, for example restaurant, museums, hotel, so the user can customize his itinerary and can watch on the cart whole itinerary he has decided himself.
regards
Marco

#1876467

As I mentioned above, you can consider custom codes, for example:
1) Create a post view, query all product posts, display the result in a map
2) Use filter hook wpv_filter_query to trigger a PHP function:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
3) In this PHP function, get the product IDs in user's cart:
https://stackoverflow.com/questions/28576667/get-cart-item-name-quantity-all-details-woocommerce
and apply those product IDs into view's query:
https://developer.wordpress.org/reference/classes/wp_query/#post-page-parameters
post__in (array) – use post ids. Specify posts to retrieve.