1. Home
  2. Knowledge Base
  3. Advanced Coupons
  4. Cart Conditions
  5. Can you add more product types to the product search boxes?
  1. Home
  2. Knowledge Base
  3. Advanced Coupons
  4. BOGO Deals
  5. Can you add more product types to the product search boxes?
  1. Home
  2. Knowledge Base
  3. Advanced Coupons
  4. Add Products
  5. Can you add more product types to the product search boxes?

Can you add more product types to the product search boxes?

Advanced Coupons only returns a fixed set of product types in its product search boxes. If another plugin adds its own product type, like bookings, bundles, or composite products, those products will not show up when you type their name into one of our search boxes.

You can change that. Since Advanced Coupons Free 4.7.5 there is a setting for it, and there is also a filter you can use in code for the cases the setting cannot cover. Both apply to the product search boxes used by Cart Conditions, BOGO Deals, and Add Products.

Which product types are searchable by default

The search boxes always return simple products, variable products, product variations, subscriptions, and subscription variations. Variable subscription products are not in that default list, so add Variable subscription from the setting below if you use them. Gift card products are returned too, except in the search boxes where a gift card is not a valid choice.

Every other product type is left out. That is partly for safety, and partly because we do not support an “official” integration with those extensions. There can be more to an integration than being able to select the products inside our search boxes.

Add extra product types from the settings

This is the quickest option, and it does not need any code.

  1. Go to Coupons > Settings in your WordPress admin.
  2. Open the General tab.
  3. Click the Additional product types in search field and select the product types you want to include.
Coupons Settings General tab with the Additional product types in search field showing Product bundle selected

A few things to know about the field:

  • The dropdown lists every product type registered on your store that is not already searchable. That includes types added by other plugins, and the two core types that are not searchable by default, Grouped product and External/Affiliate product.
  • The setting saves on its own as soon as you change it. There is no save button, and you will see a confirmation message when it goes through.
  • The default product types stay searchable no matter what you select here. You are only adding to the list.
  • The field keeps at least one selection once you have saved one. If you remove every entry, the last saved selection stays in place.

Selecting a type only affects the search boxes. Nothing else about the coupon changes, so test the coupon on a real cart afterwards to confirm the discount behaves the way you expect with that product type.

Add product types with code

The dropdown is built from the product types WooCommerce knows about, so a plugin that registers a product class without adding it to WooCommerce’s product type list will not appear there. For those cases, use the acfw_product_search_allowed_types filter instead. It runs after the setting, so you can use both together.

Here is an example snippet showing how a product type called “Booking” can be added to the products available for searching:

add_filter( 'acfw_product_search_allowed_types' , 'support_booking_product_type_in_search' );

function support_booking_product_type_in_search( $allowed_types ) {
    $allowed_types[] = 'booking';
    $allowed_types[] = 'bundle';
    $allowed_types[] = 'composite';
    return $allowed_types;
}

Adjust the snippet and include it in your functions.php or via a drop-in plugin.

Need Help?

If you have a question or run into any issues, we’re here to help.

Was this article helpful?

Related Articles

Complete Your Purchase