Display a custom promotional message above the product listing on your WooCommerce Shop page. Steps Add the code below to your theme’s functions.php. Change the message to your preferred text. Save and refresh the Shop page.
Control how many products WooCommerce displays on each Shop or product archive page. Steps Add the code below to your theme’s functions.php. Change 12 to your preferred number. Save and refresh the Shop page.
Replace WooCommerce’s default “Free!” text with your own custom text, such as “Complimentary” or “No Charge”. Steps Add the code below to your theme’s functions.php. Change the text to whatever you want. Save and check products with a price of 0.
If you don’t want WooCommerce to display the Related Products section on product pages, you can remove it completely with a simple hook. Steps Add the code below to your theme’s functions.php. Save the file. Refresh any single product page.
Control how many related products WooCommerce displays on the single product page. Steps Add the code below to your theme’s functions.php. Change 4 to your preferred number. Save and refresh a product page.
Display a “New” badge automatically on products published within the last 30 days. Steps Add the code below to your theme’s functions.php. Change 30 to the number of days you want. Add CSS to style the badge if required. Optional CSS .custom-new-badge { position: absolute; top: 10px; left: 10px; z-index: 5; background: #000; color: #fff; […]
If you want to control how many products appear in each row on the WooCommerce shop/category pages, you can use the loop_shop_columns filter. Steps Add the code below to your theme’s functions.php. Change 4 to the number of products you want per row. Save and refresh your Shop page.
Prevent swatches from appearing on certain category pages.
If you want customers to purchase only one quantity of each product, you can remove the quantity field from the WooCommerce Cart page. Steps Open your theme’s functions.php file. Add the code below. Save the file. Refresh your Cart page. Done — the quantity input will be hidden from the cart.
Let customers enter their GST number at checkout, with built-in format validation, so you can issue GST-compliant invoices for business customers — commonly needed for stores selling in India. Steps Open your theme’s functions.php file. Add the code below. Save the file. Open the WooCommerce Checkout page. Done — a new GST Number field will […]