I used ChatGPT to create iMember360 conditionals to only show a pop up on the cart page when certain products are in the cart. Here’s that whole task from start to finish:  https://wiki.trueproductions.com/article/show-elementor-pop-up-for-only-certain-products-based-on-imember360-conditionals/

Here’s the prompt I used (You can see the original ChatGPT convo here, but I’m not sure if those stay forever, so I’m pasting it too):

I am working on a WooCommece storefront built with iMember360 and Elementor. I need to create a new iMember360 conditional that evaluates as TRUE when the following conditions are met: Product ID 9192 is in the cart.

The response from ChatGPT is pasted below:

Here’s the PHP conditional you can use in iMember360 that will evaluate to TRUE if product ID 9192 is in the WooCommerce cart:

function is_product_9192_in_cart() {
if ( ! function_exists( 'WC' ) || ! WC()->cart ) return false;
foreach ( WC()->cart->get_cart() as $cart_item ) {
if ( isset( $cart_item[‘product_id’] ) && $cart_item[‘product_id’] == 9192 ) {
return true;
}
}
return false;
}is_product_9192_in_cart();

If you need to place this directly into an iMember360 conditional field (rather than adding a function to your theme), you can use the inline version:

!empty(WC()->cart) && array_search(9192, array_column(WC()->cart->get_cart(), 'product_id')) !== false

How it works:

  • WC()->cart->get_cart() returns all cart items.

  • array_column(..., 'product_id') extracts all product IDs.

  • array_search(9192, ...) !== false checks if 9192 exists in that list.

Example Usage in iMember360

If you’re using this as a PHP conditional in an Elementor visibility or shortcode condition (for example, in iMember360’s conditional logic area):

[php]return (!empty(WC()->cart) && array_search(9192, array_column(WC()->cart->get_cart(), 'product_id')) !== false);[/php]

That statement will return TRUE when the cart contains product ID 9192.