Skip Navigation

[Resolved] Upsells products are not filtered

This support ticket is created 3 years, 6 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by dmitryK-2 3 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1811341

Tell us what you are trying to do?
Hi, I have the same issue shown in thread https://toolset.com/forums/topic/upsell-and-cross-sell-filter/
My problem is - if I have at least 1 upsells product connected - it shown ok by view. If no products connected in upsells view shows ALL product from site. Can you please help to fix

Ex.1 No upsells connected
hidden link

Ex.2 at least one connected
hidden link

my code in functions.php (don't look at cross-sells it's only name of function and shortcode - it's all about ids)

//=3=Show cross-sells linked prod's on  product single*/
		add_shortcode('wpv-post-crossell-ids', 'wpv_post_crossell_ids');
			function wpv_post_crossell_ids() {
			  $ids = get_post_meta( get_the_ID(), '_upsell_ids', true);  
			  return implode(',', $ids);
			}
#1812085

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Do you mean that on the following page:
Ex.1 No upsells connected
hidden link
=> if no upsells products are there, you want to show no items found - correct? If yes:

Can you please try to adjust the shortcode you added as given under:

add_shortcode('wpv-post-crossell-ids', 'wpv_post_crossell_ids');
 function wpv_post_crossell_ids() {
              $ids = get_post_meta( get_the_ID(), '_upsell_ids', true);  
             if($ids != ''){
                   return implode(',', $ids);
             } else{
                    return 0;          
             }
}
#1812161

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.