Okay
  Public Ticket #4530230
Bulk Order Form – Option to Default Search by SKU
Open

Comments

  • Andrew started the conversation

    We are using the B2BKing Bulk Order Form on a wholesale WooCommerce site.

    We have enabled Search by SKU, and it works correctly. However, the search dropdown in the Bulk Order Form always defaults to “Search by Product.” There does not appear to be a built-in setting or shortcode attribute to change this default.

    Our use case:

    • Product item numbers match WooCommerce SKUs exactly

    • Most wholesale customers order from printed catalogs and search by item number

    • We would still like to allow product name search as a fallback, but SKU should be the default behavior

    We are intentionally avoiding custom code overrides, since future plugin updates could break them.

    Questions:

    1. Is there any supported filter, hook, or setting to make Search by SKU the default option in the Bulk Order Form?

    2. Alternatively, is there a supported way to hide “Search by Product” and only allow SKU search?

    3. If neither is currently supported, can this be considered as a feature request for a future update?

    Thanks for your help.

    Best regards,
    Andrew

    Attached files:  bulkform-sku.jpg

  •  2,628
    WebWizards replied

    Hi Andrew,

    Thank you for purchasing our plugin!

     

    While there isn't a direct setting for this, we can use a filter hook to modify the dropdown order. This is update-safe and won't be overwritten when you update the plugin.

    Please add the following code snippet to your child theme's functions.php file or to any code snippets plugin:

    add_filter('b2bking_classic_form_searchby_display', function($content) {
        $new_content = '
        <select id="b2bking_bulkorder_searchby_select">
            <option value="sku">' . apply_filters('b2bking_sku_search_display', esc_html__('SKU', 'b2bking')) . '</option>
            <option value="productname">' . esc_html__('Product Name', 'b2bking') . '</option>
        </select>';
        
        return $new_content;
    }, 10, 1);

    This will switch the order of those 2 options and show SKU first.

     

    Let me know if that works for you!

    Kind regards,
    Stefan

  • Andrew replied

    Perfect. Thank worked! Thanks so much :)
    Happy New Year!

  •  2,628
    WebWizards replied

    Happy New Year!

    Glad that worked for you. If you run into any other issues or anything we can help with, please let us know.

    Kind regards,
    Stefan