Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/70890d4a5036d9ed7569d6a268d8261d to your computer and use it in GitHub Desktop.
Save plugin-republic/70890d4a5036d9ed7569d6a268d8261d to your computer and use it in GitHub Desktop.
<?php
/**
* Filter which product type is used in the Products field
* @param $product_type
* @param $product_id Product ID - use this to conditionally change product type per product
* @param $field_id Field ID - use this to conditionally change product type per field
*/
function prefix_search_products( $product_type, $product_id, $field_id ) {
$product_type = 'woocommerce_json_search_products_and_variations'; // Allows you to include variations
// $product_type = 'variable_subscriptions'; // Include variations for subscriptions
return $product_type;
}
add_filter( 'pewc_filter_child_products_method', 'prefix_search_products', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment