Okay
  Public Ticket #4138708
Add GTIN, UPC, EAN on bulk order
Open

Comments

  •  2
    Dario started the conversation

    Hello,

    I hope you're doing well. 

    We are using the Bulk Order Form – Classic Theme, and I would like to add support for searching products by barcode. Specifically, I would like the search field to also look into the product meta field called `_global_unique_id`, which we use to store GTIN, UPC, EAN, or ISBN codes.

    If this customization is possible within the Classic Theme, I would greatly appreciate your help with implementing it.

    Thank you in advance!

    Attached files:  barcodee.jpg

  •  2,468
    WebWizards replied

    Hi Dario,

    Yes, we can do that using some code snippets:

    You can add the following code snippets to your theme's functions.php file or using a code snippets plugin:

    add_filter('b2bking_sku_search_key_additional','__return_true');
    add_filter('b2bking_sku_search_key_additional_value', function($val){
    	return '_global_unique_id';
    }, 10, 1);
    
    add_filter('b2bking_sku_search_display', function($key){
    	return 'SKU / Unique ID';
    }, 10, 1);

    This will modify the SKU search functionality so that when you select the SKU search option in the form, it will search both the product SKU and your custom '_global_unique_id' field that contains the GTIN/UPC/EAN codes.

    The last filter also changes the display text of the search option from "SKU" to "SKU / Unique ID" on the frontend.

     

    Let me know if you need any clarification or run into any issues!

    Kind regards,

    Stefan