How To Add Repeatable Fields To WooCommerce Products

Tested & Works

The code in this download folder adds a repeatable custom fields meta box in Woocommerce. In this case, the code does exactly this :

  1. Adds a checkbox to the WooCommerce Bookable Product > General tab for Has Sizes : Check this box if the product has sizes so the checkbox only displays when a bookable product is selected not when other types of products are selected.
  2. If it’s a bookable product and the checkbox is checked, display a meta box with repeatable fields for sizes and corresponding product id’d. In this case its used to display links on the frontend of the bookable product if the product has sizes and links to the page based on the product id for each size.

You can use this code for any type of product simply by changing the conditional tag included in the code to another product type.

Demo Video

Shows exactly whats stated in this above description.


There’s 2 steps :

  1. Copy and paste the PHP code to the end pf your child themes functions file or custom functionality/code snippets plugin.
  2. Optional : To style the output for each link for sizes, add the CSS from the style.css file to the end of your child themes style sheet or additional CSS field if using blocks.