Header <form>
don’t have action=""
attribute. So basically what form do, when you search, is append s=keyWord
in current url, that is why you have url like this https://techcart.pk/product/8mm-led-10pcs/?s=abc.
What you need to to is to add action=""
in <form>
.
You can inspect element in sidebar search field and you can see this markup:
<form role="search" method="get" action="https://techcart.pk/">
So basically you need to do the same on header search. Just replace action URL to be dynamically, like this:
<form role="search" method="get" action="<?php echo esc_url( home_url() ); ?>">
Related Posts:
- WordPress default Search function inconsistent in WooCommerce Product Titles
- Woocommerce – Include custom user meta in order ‘filter by registered customer’ Ajax search
- Product Search in search.php
- How to correctly add Javascript in functions.php
- Genesis – Customize search form
- Remove Woocommerce product link
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- Woocommerce: How to override core functions in functions.php?
- Get WooCommerce shipping methods programmatically
- Add a custom text field to WooCommerce admin product data “Variations”
- Translating add to cart woocommerce button [closed]
- Add attribute / custom attribute to product in woocommerce
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- Count the number of times the search form template gets included on a page
- Help with some php math in WordPress
- esc_url returns incorrect URL
- How do I display a user’s previous orders as a select box option on a product?
- combine Code 1 with Code 2
- Adding nofollow to a PHP generated Nav
- Customising the search function?
- Automated Cart Update With Alert Box Each Time
- Two Different Links for Same Product – WooCommerce [closed]
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- Show prices with tax in Woocommerce Mini Cart [closed]
- Problem with custom plugin using AJAX to pull info from php file
- Reload part of checkout on changed shipping method
- How to get all shipping rates and costs without session in woocommerce?
- Display a specific category of products in shop page and disable code for specific actions
- Woocommerce related product text
- Trying to build simple deposit code that hooks into woocommerce
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- Function works when I don’t login to WordPress but when I login then it doesn’t work
- How to make products with no cost in WooCommerce
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- edit search.php to include subdomain posts
- Search Query: how to construct a search string from two select elements?
- How to remove coupon dropdown feature
- Add html link in functions.php files of the theme
- Add product to cart for user – WC()->cart->add_to_cart [closed]
- Seo Friendly Filter URLs
- how can i add class or span tag at sprintf?
- Display attribute on shop page after the title
- WooCommerce – Moving Product Price to the Left of Add to Cart Button [closed]
- WordPress WP_Query without query GET parameters
- Where to copy woocommerce files to in my custom theme to avoid editing the core plugin?
- Have Woocommerce show product price if id, when not logged in
- Custom reduce stock code affecting date_modified – How to bypass?
- Output product category link from WP_Query
- How to get woocommerce orders with get_posts method in a shortcode
- Display WordPress search results based on the selected Sub-Category
- how can i include post meta in search result
- Variation prices breakdown only for single product page
- WooCommerce Query Product Titles
- How to search order using database frontend short code WordPress
- How to add a shortcode which runs a .php file for the current post
- Limit Search to Product Pages only unless I’m on Blogpage or Blogposts
- Variant Item SKU as Product Code
- Run a sql (update) after 12 hours after the user login. Woocommerce users
- How can I change the background color of divs dynamically (depending on an order-status in woocommerce)?
- Add a new view on the Woocommerce account page
- Best way to use variables in multiple functions?
- Display all categories including sub categories under a list ul
- Use Search Term in html link and redirect
- How to get content on a blank basket/cart page in a custom theme with woocommerce
- WooCommerce REST API AJAX Auth – 401 response
- Looping through and combining calls to Woocommerce REST API
- Get product price in a different currency using WooCommerce Currency Switcher
- How to import woocommerce custom fields data into another site?
- Woocommerce – if selected attribute term equals
- split 1 cart item into instock and back ordered
- Adding a widget under an ‘Add to Cart’ button through a PHP snippet
- Add custom ID attribute to all woocommerce products on archive pages
- Put a span class in the shortened product title
- How to properly create multiple conditions to redirect users roles to different pages
- How can i put php code on the wordpress page?
- what’s the syntax for if the image exists get the image?
- making a search.php query
- How to detect if a revision was made by woocommerce or wordpress?
- Need Quick Help With Product Category Page
- How do I prevent a folder from reappearing in my home directory?
- jQuery doesn’t work in my php snippet
- Use WP_Query Data In Cookie
- How to add custom checkout field in user details mail template
- How to set up and use a custom upload directory for post type ‘product’
- How to get the rating value of each comment
- Add specific phrase after every product title including the discounted price? [closed]
- Display Sale Price Before Regular Price (WooCommerce)
- Setting WooCommerce currency programmatically
- WooCommerce Orders pagination
- Product Category Page in Full Width
- After declaring woocommerce theme support products are no longer displayed
- WooCommerce – Show ‘Sales’ badge on variable products where only some variations have sales price [closed]
- How to create a container in php then customise it in CSS
- Show button in header when product custom field is not empty
- WordPress 6.1.1 UTF8 Slug Limit Increase
- Woocommerce Convert existing order to the cart
- How to change shipping method title based on cart amount?
- Woocommerce product variations getting created without attribute values selected
- How to add SKU and remove product title from WooCommerce url?
- using custom pages for myaccount in woocommerce