i’m working with woocommerce plugin in wordpress and i want modify the search bar (styles and html) the php that contains is thaps-search-from.php in the image you can see the directory route,
for example I want delete the button
<button id='thaps-search-button' value="<?php echo esc_attr_x( 'Submit','submit button', 'th-advance-product-search' ); ?>" type='submit'>
modify the file directly and this worked but
What is the correct way to do this?
2
Answers
i think you ll need to copy that file to your theme folder under woocommerce folder to override it and modify it, in other words you have to create a folder called woocommerce and put that specific folder/file to it, like that if woocommerce get updated it ll not break/reset your code.
First of all that is not the WooCommerce plugin that you’re working on. it’s TH Advance Product Search plugin for advanced product search.
This plugin doesn’t have template path-based customization but it provides a filter that you can use to customize the form HTML file.
In file https://plugins.svn.wordpress.org/th-advance-product-search/trunk/inc/thaps.php you can find this line, that gives you a hook to provide a file path, which means you can copy the file into your child theme and add a filter on this hook and return your child theme file path.
First of all copy
inc/thaps-search-from.php
file in your child theme’swoocommerce
folder, and you can make customization in this copied file.then you need to add this code to replace the file path.
Note: I have not tested the code so if you find any error after adding the code, please let me know what is the error I will fix the code.