How to add WooCommerce product categories to the WordPress menu?

How to add WooCommerce product categories to the WordPress menu?

By default, WordPress doesn’t show you the product categories to be added to the menu. You might only see the options like -Posts- or the Posts categories.

You’ll wonder how can you can your custom product categories from Woocommerce dynamically without using the custom link in WordPress menus.

So, how to add product categories to the WordPress menu?

Here are the steps:

  • Go to Appearance > Menus
  • Look for the Screen Options at the upper right corner of the dashboard. Expand through clicking on it.
  • In the boxes, you’ll see a list of checkboxes. We want “Product Categories” to show so we make sure that is checked. It will automatically show it on the edit menu options below.

Also, read:  Woocommerce Change Text on Checkout Page | Quick Tutorial

  • Now you can add the categories you want on your menu. Make sure to check what menu you are editing. To do that, check your menu name and the display location.
  • If you’re not editing the right one, look for Select a menu to edit: option then choose your menu and click on select.
  • On the product categories at the left side, select the categories you want to add and then click on the Add to the menu button. These will appear to your selected menu.
  • From there you can rearrange your menu depending on your liking by drag and drop.
  • You can also make the menu as a dropdown by dragging the menu to the right and drop – this will look indented. The menu above will automatically be the parent menu which shows the indented menu as a drop-down
  • Once done, save your menu by clicking on Save Menu button.

Woocommerce Change Text on Checkout Page | Quick Tutorial

Woocommerce Change Text on Checkout Page tutorial will cover only how to change the texts in the woocommerce checkout page using a function. Manually changing it on the wocoommerce core files is not advisable.

Someone asked me how do they remove the words “have read and” from the Woocommerce checkout page : “I have read and accept the terms & conditions“.

woocommerce change text on checkout page
Woocommerce Change Text on Checkout Page | Radiobox

The first step that was on my mind is using the translation function in wordpress and it should remove the 3 words by replacing the whole text statement.

I am going to change the texts using the Gettext  filter hook in WordPress. I copied the whole texts and created a function, this is the one below:

  1. function woo_checkout_texts( $changed_text, $text, $domain ) {
  2.  if ( $changed_text == 'I have read and accept the terms & conditions' ){
  3.  $changed_text = 'I accept the terms & conditions';
  4.  }
  5.  return $changed_text;
  6. }
  7. add_filter( 'gettext', 'woo_checkout_texts', 20, 3 );

But the when I checked the website’s checkout page, it doesn’t change. I forgot that the link was composed of an anchor tag. Therefore when you translate something you should also add the static markup that is between the text you are translating/changing.

So how?

I looked into the woocommerce plugin folder and find the file containing the texts in it that we can copy and modify into our functions.php file. Yes, we just copy and modify it into our functions.php file.

Modifying and saving plugin’s core file is not a good practice. In a plugin update these changes will get lost.

So to make it professional as possible, I’ve search files inside the woocommerce plugin with a word “checkout”. There, I found the terms.php file. I’ve open it on my editor and found this content.

woocommerce change text on checkout page
Woocommerce Change Text on Checkout Page | Terms

Now I’ve got the idea of how to change texts on the checkout page in woocommerce.

I’ve copied the text and pasted it on functions.php with my function. I’ve copied it again as a translated text by removing the words’ “have read and”.

This is final function below:

  1. function woo_checkout_texts( $changed_text, $text, $domain ) {
  2.  if ( $changed_text == 'I’ve read and accept the <a href="%s" target="_blank">terms & conditions</a>' ){
  3.  $changed_text = 'I accept the <a href="%s" target="_blank">terms & conditions</a>';
  4.  }
  5.  return $changed_text;
  6. }
  7. add_filter( 'gettext', 'woo_checkout_texts', 20, 3 );

I’ve checked the checkout page, done, now it is finally translated.

This is how you customize the checkout page texts in woocommerce.