The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WooCommerce Ajax Categories Meta Box

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #267372

    I’m helping build a WooCommerce site that sells engine repair products. The problem is, in the Admin, the add/edit product page takes a VERY long time to load because it’s trying to load all the product categories all at once, and there’s about 45,000 of them. That number is largely unavoidable, because there are 6 main-level categories (Automotive, Semis, Construction Equipment, Marine/Boats, Motorcycles, and Agricultural). For each type of equipment, they’re broken down into subcategories for Make, Model, and Year. In each main category, there can be many makes, then for each make, there can be many models, and for each model, there can be many years to choose from.

    To speed up the load time of the product add/edit page, I want to replace the default category selector meta box that appears on the right side of the page with an Ajax-loading category meta box. Instead of retrieving and listing ALL the categories all at once within a nested UL of check-boxes, I want the box to ONLY query for the top-level categories and list those. When a user checks that box (or clicks something to expand it), it should query and load via Ajax ONLY the categories that are a direct descendant of that checked category, etc. until it gets to the bottom level. When the user saves the product, it would then save the item in the checked categories.

    For the Edit piece, the desired effect would be to get the category hierarchy for the product being edited, then “check” the boxes using Ajax as well.

    Is there a way to do this? If so, what would be the best way to go?

Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.