{"id":40003,"date":"2023-05-29T12:12:25","date_gmt":"2023-05-29T12:12:25","guid":{"rendered":"https:\/\/crocoblock.com\/knowledge-base\/?post_type=article&#038;p=40003"},"modified":"2023-07-28T13:49:31","modified_gmt":"2023-07-28T13:49:31","slug":"how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query","status":"publish","type":"article","link":"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/","title":{"rendered":"How to Display WooCommerce Product Categories with Products in Stock Using Open AI Query"},"content":{"rendered":"\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/sql-query-generated-by-ai-in-query-builder-of-jetengine_2x.png\" alt=\"sql query generated by ai in query builder of jetengine\">\n\n\n<div class=\"note-banner d-flex border-bold border-jetthemecore rounded overflow-hidden p-20\"><div class=\"mr-12\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M9 21C9 21.5 9.4 22 10 22H14C14.6 22 15 21.5 15 21V20H9V21ZM12 2C8.1 2 5 5.1 5 9C5 11.4 6.2 13.5 8 14.7V17C8 17.5 8.4 18 9 18H15C15.6 18 16 17.5 16 17V14.7C17.8 13.4 19 11.3 19 9C19 5.1 15.9 2 12 2Z\" fill=\"#F2D23C\"\/><\/svg><\/div><div class=\"d-flex flex-column\"><div class=\"text-900 mb-12\">Things to know<\/div><p class=\"m-0\">AI functionality is allowed only for subscription plans that include the JetEngine plugin (Lifetime, All-Inclusive, and Custom Subscriptions where JetEngine is included). The number of requests to AI is limited \u2014 30 requests per month for Lifetime subscriptions and 5 requests per month for other subscriptions. This is the general limit for all websites that use the given license key (therefore, all websites share the same limit). Mind that the AI functionality is available only for the main key. It is not available for sub-keys.<\/p>\n<p>Please activate or upgrade your license to use AI functionality.<\/p>\n<p>Also you can generate query with any public AI chat.<br \/>\n<\/p><\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-generate-the-sql-query-with-the-open-ai\">How to Generate the SQL Query with the Open AI<\/h2>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\"><div class=\"wp-block-group__inner-container\">\n<h3 class=\"wp-block-heading\" id=\"create-new-custom-query\">Create new custom query<\/h3>\n\n\n\n<p>Firstly, make sure that the main license key is activated in <strong><em>WordPress Dashboard &gt; Crocoblock &gt; License<\/em><\/strong><em>.<\/em><\/p>\n\n\n\n<p>Then, proceed to <strong><em>WordPress Dashboard &gt; JetEngine &gt; Query Builder &gt; Add New <\/em><\/strong>to create a new query.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Select \u201cSQL\/AI Query\u201d as the <strong>Query Type<\/strong>. The generating tool will be located in the settings of the \u201cSQL\/AI Query\u201d.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/creating-sql-ai-query_2x.png\" alt=\"creating sql ai query\">\n\n\n\n<p>Give a <strong>Name <\/strong>to your query. <strong>Description<\/strong> and <strong>Query ID <\/strong>fields are optional.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"activate-the-advancedai-mode\">Activate the Advanced\/AI mode<\/h3>\n\n\n\n<p>The first toggle in the query settings prompts to activate the <strong>Advanced\/AI mode<\/strong>. Toggle it on.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/activating-advanced-ai-mode-in-sql-query-settings_2x.png\" alt=\"activating advanced ai tool in the sql query settings\">\n\n\n\n<p>Now that the <strong>Advanced<\/strong> <strong>mode <\/strong>is activated, new settings appear. In the <strong>SQL Query <\/strong>area, you can write your own SQL Query. To open the AI generator tool, click the \u201c<strong>Magic Wand<\/strong>\u201d<strong> <\/strong>button in the top right corner of the <strong>SQL Query <\/strong>field area.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/overview-of-the-settings-of-the-advanced-ai-mode-in-sql-query_2x.png\" alt=\"overview of the settings of the advanced ai mode in sql query\">\n\n\n\n<h3 class=\"wp-block-heading\" id=\"write-prompt\">Write prompt<\/h3>\n\n\n\n<p>The popup includes the field for entering the prompt, useful tips on writing a good prompt, and prompt examples.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/sql-query-generator-tool-overview_2x.png\" alt=\"sql query generator tool overview\">\n\n\n\n<p>You can type in the needed request in the <strong>Describe your query <\/strong>field. The response will be received through the API, and the SQL query will be parsed from it and inserted.<\/p>\n\n\n\n<p>Prompt examples are clickable; when clicking on one, the prompt will be entered into the field to generate a further query based on it. Mind that prompts from the examples still count in the general limit of requests to AI, so use the generator only when you are sure of your prompt.<\/p>\n\n\n\n<p>We will use one of the ready examples to generate the query: \u201cWooCoomerce. Select product categories with products in stock. Product stock status is stored in &#8216;_stock_status&#8217; meta field. Return only unique terms and all data from terms table.\u201d<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/generating-woocommerce-sql-query-using-ai-in-jetengine-query-builder_2x.png\" alt=\"generating woocommerce sql query using ai in jetengine query builder\">\n\n\n\n<p>After entering the prompt and clicking on the<strong> <\/strong>\u201c<strong>Generate query<\/strong>\u201d<strong> <\/strong>button, the query generation process takes place. The process requires from several seconds to a minute to finish.&nbsp;<\/p>\n\n\n\n<p>If successful, the generated query will be added to the same field, replacing the initial request, where it can be corrected and further applied. If necessary, generate another query using a new prompt by clicking the \u201c<strong>Generate new query<\/strong>\u201d button. Remember that each time a new query is generated counts as one request.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/sql-query-generated-by-ai-in-query-builder-of-jetengine_2x.png\" alt=\"sql query generated by ai in query builder of jetengine\">\n\n\n<div class=\"note-banner d-flex border-bold border-jetsmartfilters rounded overflow-hidden p-20\"><div class=\"mr-12\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M1 21H23L12 2L1 21ZM13 18H11V16H13V18ZM13 14H11V10H13V14Z\" fill=\"#FA5450\"\/><\/svg><\/div><div class=\"d-flex flex-column\"><div class=\"text-900 mb-12\">Warning<\/div><p class=\"m-0\">Please note that the generated SQL query is created by the AI system to match your description best. Remember to review the query carefully, as it might not be 100% accurate.<\/p><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"try-more-complex-cases-with-dynamic-data\">Try more complex cases with dynamic data<\/h3>\n\n\n\n<p>Now, let\u2019s try to adjust the prompt.&nbsp;<\/p>\n\n\n\n<p>Assuming we need to retrieve only first-level product categories (regardless of whether they have child categories), we would write this prompt: \u201cWooCommerce. Select only first-level product categories. Return only unique terms and all data from terms table\u201d.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/select-only-first-level-product-categories-with-ai-query_2x.png\" alt=\"select only first-level product categories with ai query\">\n\n\n\n<p>In our example, we have five product categories, only three of them being first-level categories.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/product-categories-of-woocommerce-overview_2x.png\" alt=\"product categories of woocommerce overview\">\n\n\n\n<p>In the results of the query, we see these three categories.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/results-for-query-retrieving-only-first-level-product-categories_2x.png\" alt=\"results for query retrieving only first-level product categories\">\n\n\n\n<p>This custom query is ready for use as it is \u2014 it retrieves unique product categories where the parent category equals 0 (remember that the \u2018term_taxonomy\u2019 table has a column named \u2018parent\u2019 that stores the ID of the parent term; if the value of the \u2018parent\u2019 column equals 0, it means, the category is the first-level category because it has no parents).&nbsp;<\/p>\n\n\n\n<p>Now, let\u2019s try something more complex. The next goal is to retrieve only second-level product categories that belong to the current product.&nbsp;<\/p>\n\n\n\n<p>We have such a tree of product categories: Clothing &gt; Women\u2019s Collections &gt; Spring Collection.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/tree-of-product-categories_2x.png\" alt=\"tree of product categories\">\n\n\n\n<p>For this product, the retrieved category should be \u201cWomen\u2019s Collections\u201d.&nbsp;<\/p>\n\n\n\n<p>Before writing the prompt, we should break our task into smaller parts and elaborate on each part. Remember that the best practice is to write the prompt in a way you would structure the SQL query itself. Keep the description concise \u2014 prompts have a limit of 400 characters. The lengthier the prompt is, the harder it is for AI to understand it.&nbsp;<\/p>\n\n\n\n<p>So, the parts we should consider are:&nbsp;<\/p>\n\n\n\n<ol>\n<li>The AI should look in <em>WooCommerce <\/em>database tables;<\/li>\n\n\n\n<li>The AI should select only second-level product categories;<\/li>\n\n\n\n<li>The product categories should belong to the current product. We know that the ID of the current product can be retrieved dynamically with the %current_id% macro (check the <a href=\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/macros-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">Macros Guide<\/a> for more information). It is important to mention it to the AI;<\/li>\n\n\n\n<li>The parent product category of the retrieved product category should be a parent category itself. Therefore, the parent category of the retrieved category should not have parents. This way, we select only second-level terms and not all terms that count as child terms (e.g., the \u2018Spring Collection\u2019 product category should not be included in the results);<\/li>\n\n\n\n<li>Terms should be unique;<\/li>\n\n\n\n<li>All data from the terms table should be retrieved.<\/li>\n<\/ol>\n\n\n\n<p>Having considered the points above, we can write the following prompt:<\/p>\n\n\n\n<p>\u2018WooCoomerce. Select only second-level product categories of the current product. The parent product category of the returned product categories should not have a parent category. The ID of the current product is retrieved with %current_id% macro. Return only unique terms and all data from terms table.\u2019<\/p>\n\n\n\n<p>The result is exactly what we need.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/sql-query-that-retrieves-second-level-product-categories-of-current-product_2x.png\" alt=\"sql query that retrieves second-level product categories of current product\">\n\n\n\n<p>Nevertheless, there is an area for improvement. To optimize the query, we can remove the line that says \u2018AND tt.parent != 0;\u2019.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/adjusting-the-sql-query-generated-by-ai_2x.png\" alt=\"adjusting the sql query generated by ai\">\n\n\n\n<h3 class=\"wp-block-heading\" id=\"review-and-adjust-the-query\">Review and adjust the query<\/h3>\n\n\n\n<p>Once you are satisfied with the result, click the \u201c<strong>Use this query<\/strong>\u201d<strong> <\/strong>button to paste the query into the <strong>SQL Query <\/strong>field. We will stick with the first generated query.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/using-generated-sql-query-by-ai-in-sql-ai-query_2x.png\" alt=\"using generated sql query by ai in sql ai query\">\n\n\n\n<p>You can activate the <strong>Preview results <\/strong>toggle to see if the results match your expectations. The query results should display the data from the product categories that have products in stock.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/activating-preview-results-mode-in-sql-ai-query_2x.png\" alt=\"activating preview results mode in sql ai query\">\n\n\n\n<p>In our example, the query returns four properties \u2014 \u2018term_id,\u2019 \u2018name,\u2019 \u2018slug,\u2019 and \u2018term_group.\u2019 These are the only properties available for choosing in the <a href=\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/dynamic-field-widget-overview\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Dynamic Field<\/strong><\/a><strong> <\/strong>widget\/block when you move on to designing the <a href=\"https:\/\/crocoblock.com\/knowledge-base\/features\/listing-template-in-elementor-overview\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Listing Template<\/strong><\/a>. It means this is the only dynamic data you can display in the listing. Other category fields that are default to <em>WooCommerce <\/em>cannot be used (e.g., category thumbnail). Also, if you have meta fields attached to product categories, they cannot be retrieved.&nbsp;<\/p>\n\n\n\n<p>In some cases, the given properties are enough to style the <strong>Listing Template<\/strong>. However, often it is important to have access to all the fields related to the object (such as the thumbnail and meta fields of the product category). For this, scroll the settings of the custom query down to the <strong>Cast result to instance of object<\/strong> setting.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/using-cast-result-to-instance-of-object_2x.png\" alt=\"using cast result to instance of object\">\n\n\n\n<p>Select the \u201cTaxonomy Term\u201d option. Now, the objects in the query results are converted to taxonomy terms, and you are not limited to the four properties returned by the <strong>SQL Query <\/strong>anymore.<\/p>\n\n\n\n<p>Press the \u201c<strong>Add Query<\/strong>\u201d<strong> <\/strong>button to save the query.<\/p>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-display-the-results-of-the-sql-query-using-a-listing-template\">How to Display the Results of the SQL Query Using a Listing Template<\/h2>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\"><div class=\"wp-block-group__inner-container\">\n<p>There are two ways to display the query results \u2014 either by creating a <strong>Listing Template <\/strong>for <strong>Query Builder <\/strong>and using properties returned by<strong> SQL query <\/strong>to build the listing; or by applying the query on a <a href=\"https:\/\/crocoblock.com\/knowledge-base\/features\/listing-grid-widget-overview\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Listing Grid<\/strong><\/a> with a ready <strong>Listing Template<\/strong> for product categories.<\/p>\n\n\n<div class=\"note-banner d-flex border-bold border-jetsmartfilters rounded overflow-hidden p-20\"><div class=\"mr-12\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M1 21H23L12 2L1 21ZM13 18H11V16H13V18ZM13 14H11V10H13V14Z\" fill=\"#FA5450\"\/><\/svg><\/div><div class=\"d-flex flex-column\"><div class=\"text-900 mb-12\">Warning<\/div><p class=\"m-0\">It is important to note that it is required to create a new <strong>Listing Template<\/strong> with the \u201cQuery Builder\u201d source if you didn\u2019t use the <strong>Cast results to instance of object<\/strong> setting.<\/p><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"create-a-new-listing-template-for-sql-query\">Create a new listing template for SQL query<\/h3>\n\n\n\n<p>Navigate to <strong><em>WordPress Dashboard &gt; JetEngine &gt; Listings &gt; Add New <\/em><\/strong>to create a new <strong>Listing Template<\/strong>.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/creating-listing-template-for-sql-query-to-display-woocommerce-categories-in-stock_2x.png\" alt=\"creating listing template for sql query to display woocommerce categories in stock\">\n\n\n\n<p>Select the \u201cQuery Builder\u201d option as the <strong>Listing source<\/strong>. Next, select the previously created SQL <strong>Query<\/strong>. Give a name to the listing template. Finally, select the <strong>Listing view<\/strong>. We will use \u201cElementor\u201d in our example.&nbsp;<\/p>\n\n\n\n<p>Push the \u201c<strong>Create Listing Item<\/strong>\u201d<strong> <\/strong>button to go to the editor of the template.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"fill-the-listing-template-with-content\">Fill the listing template with content<\/h3>\n\n\n\n<p>Now, it is time to design the listing template. Later, it will define the layout of the <a href=\"https:\/\/crocoblock.com\/knowledge-base\/features\/listing-grid-widget-overview\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Listing Grid<\/strong><\/a>.<\/p>\n\n\n\n<p>Use the <a href=\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/dynamic-field-widget-overview\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Dynamic Field<\/strong><\/a> to display data from the product category \u2014 for example, product category name.&nbsp;<\/p>\n\n\n\n<p>To display the product category name, select the \u201cPost\/Term\/User\/Object Data\u201d option as the <strong>Source <\/strong>of the <strong>Dynamic Field<\/strong>; then, select \u201cTerm name\u201d in the <strong>Object Field <\/strong>dropdown.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/using-dynamic-field-widget-to-display-information-about-product-cateogory-of-woocommerce_2x.png\" alt=\"using dynamic field widget to display information about product category of woocommerce\">\n\n\n\n<p>The same settings are applied in Gutenberg.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/using-dynamic-field-block-to-display-information-about-product-category-of-woocommerce_2x.png\" alt=\"using dynamic field block to display information about product category of woocommerce\">\n\n\n\n<p>To display the product category thumbnail, place the <strong>Dynamic Image <\/strong>in the editing area. In the <strong>Custom meta field\/repeater key<\/strong> field, insert the \u2018thumbnail_id\u2019 field name:<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/using-dynamic-image-to-display-product-category-thumbnail_2x.png\" alt=\"using dynamic image to display product category thumbnail\">\n\n\n\n<p>Once you finish styling the listing, save the changes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"display-the-listing-using-the-listing-grid-widgetnbsp\">Display the listing using the Listing Grid widget&nbsp;<\/h3>\n\n\n\n<p>Move to the page or template where the product categories should be displayed and open it in the editor.&nbsp;<\/p>\n\n\n\n<p>Place the <strong>Listing Grid <\/strong>widget\/block on the page. Select the <strong>Listing <\/strong>template created previously.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/displaying-product-categories-of-woocommerce-in-listing-grid-widget_2x.png\" alt=\"displaying product categories of woocommerce in listing grid widget\">\n\n\n\n<p>Note that you do not need to apply the query in the <strong>Custom Query <\/strong>tab of <strong>Listing Grid <\/strong>settings.<\/p>\n<\/div><\/div>\n\n\n\n<p>That\u2019s it. Now, your listing is using a custom query generated by AI to display product categories with products in stock.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to generate SQL Query in JetEngine&#8217;s Query Builder using the AI Query feature to showcase WooCommerce product categories with products in stock.<\/p>\n","protected":false},"author":9,"featured_media":0,"template":"","format":"standard","builder-category":[],"article-category":[405],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Generate SQL Query for WooCommerce Products in Stock with OpenAI | Crocoblock<\/title>\n<meta name=\"description\" content=\"Learn how to generate SQL Query in JetEngine&#039;s Query Builder using the AI Query feature to showcase WooCommerce product categories with products in stock.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Generate SQL Query for WooCommerce Products in Stock with OpenAI | Crocoblock\" \/>\n<meta property=\"og:description\" content=\"Learn how to generate SQL Query in JetEngine&#039;s Query Builder using the AI Query feature to showcase WooCommerce product categories with products in stock.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/\" \/>\n<meta property=\"og:site_name\" content=\"Help Center\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-28T13:49:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/sql-query-generated-by-ai-in-query-builder-of-jetengine_2x.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/\",\"url\":\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/\",\"name\":\"Generate SQL Query for WooCommerce Products in Stock with OpenAI | Crocoblock\",\"isPartOf\":{\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#website\"},\"datePublished\":\"2023-05-29T12:12:25+00:00\",\"dateModified\":\"2023-07-28T13:49:31+00:00\",\"description\":\"Learn how to generate SQL Query in JetEngine's Query Builder using the AI Query feature to showcase WooCommerce product categories with products in stock.\",\"breadcrumb\":{\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/crocoblock.com\/knowledge-base\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Articles\",\"item\":\"https:\/\/crocoblock.com\/knowledge-base\/articles\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Display WooCommerce Product Categories with Products in Stock Using Open AI Query\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#website\",\"url\":\"https:\/\/crocoblock.com\/knowledge-base\/\",\"name\":\"Help Center\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/crocoblock.com\/knowledge-base\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#organization\",\"name\":\"Help Center\",\"url\":\"https:\/\/crocoblock.com\/knowledge-base\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2025\/04\/invert-crocoblock-logo.svg\",\"contentUrl\":\"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2025\/04\/invert-crocoblock-logo.svg\",\"caption\":\"Help Center\"},\"image\":{\"@id\":\"https:\/\/crocoblock.com\/knowledge-base\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Generate SQL Query for WooCommerce Products in Stock with OpenAI | Crocoblock","description":"Learn how to generate SQL Query in JetEngine's Query Builder using the AI Query feature to showcase WooCommerce product categories with products in stock.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/","og_locale":"en_US","og_type":"article","og_title":"Generate SQL Query for WooCommerce Products in Stock with OpenAI | Crocoblock","og_description":"Learn how to generate SQL Query in JetEngine's Query Builder using the AI Query feature to showcase WooCommerce product categories with products in stock.","og_url":"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/","og_site_name":"Help Center","article_modified_time":"2023-07-28T13:49:31+00:00","og_image":[{"url":"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2023\/05\/sql-query-generated-by-ai-in-query-builder-of-jetengine_2x.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/","url":"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/","name":"Generate SQL Query for WooCommerce Products in Stock with OpenAI | Crocoblock","isPartOf":{"@id":"https:\/\/crocoblock.com\/knowledge-base\/#website"},"datePublished":"2023-05-29T12:12:25+00:00","dateModified":"2023-07-28T13:49:31+00:00","description":"Learn how to generate SQL Query in JetEngine's Query Builder using the AI Query feature to showcase WooCommerce product categories with products in stock.","breadcrumb":{"@id":"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/crocoblock.com\/knowledge-base\/jetengine\/how-to-display-woocommerce-categories-with-products-in-stock-jetengine-ai-query\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/crocoblock.com\/knowledge-base\/"},{"@type":"ListItem","position":2,"name":"Articles","item":"https:\/\/crocoblock.com\/knowledge-base\/articles\/"},{"@type":"ListItem","position":3,"name":"How to Display WooCommerce Product Categories with Products in Stock Using Open AI Query"}]},{"@type":"WebSite","@id":"https:\/\/crocoblock.com\/knowledge-base\/#website","url":"https:\/\/crocoblock.com\/knowledge-base\/","name":"Help Center","description":"","publisher":{"@id":"https:\/\/crocoblock.com\/knowledge-base\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/crocoblock.com\/knowledge-base\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/crocoblock.com\/knowledge-base\/#organization","name":"Help Center","url":"https:\/\/crocoblock.com\/knowledge-base\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/crocoblock.com\/knowledge-base\/#\/schema\/logo\/image\/","url":"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2025\/04\/invert-crocoblock-logo.svg","contentUrl":"https:\/\/crocoblock.com\/knowledge-base\/wp-content\/uploads\/2025\/04\/invert-crocoblock-logo.svg","caption":"Help Center"},"image":{"@id":"https:\/\/crocoblock.com\/knowledge-base\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/article\/40003"}],"collection":[{"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/types\/article"}],"author":[{"embeddable":true,"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/users\/9"}],"wp:attachment":[{"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=40003"}],"wp:term":[{"taxonomy":"builder-category","embeddable":true,"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/builder-category?post=40003"},{"taxonomy":"article-category","embeddable":true,"href":"https:\/\/crocoblock.com\/knowledge-base\/wp-json\/wp\/v2\/article-category?post=40003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}