{"id":775,"date":"2021-05-27T16:58:35","date_gmt":"2021-05-27T16:58:35","guid":{"rendered":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons-new-new\/?p=775"},"modified":"2023-07-11T11:29:48","modified_gmt":"2023-07-11T11:29:48","slug":"conditional-logic","status":"publish","type":"post","link":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/","title":{"rendered":"Conditional logic"},"content":{"rendered":"\n<p>The conditional logic is extremely useful if you want to hide or show some options based on what the customer selects in another options set.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" width=\"1561\" height=\"900\" src=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg\" alt=\"Conditional logic - free version\" class=\"wp-image-1936\" srcset=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg 1561w, https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free-300x173.jpg 300w, https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free-1024x590.jpg 1024w, https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free-768x443.jpg 768w, https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free-1536x886.jpg 1536w\" sizes=\"auto, (max-width: 1561px) 100vw, 1561px\" \/><\/a><\/figure>\n\n\n\n<p>After enabling the creation of display conditions, you will be able to set up the display rules.<\/p>\n\n\n\n<p>You can choose whether to <strong>show<\/strong> or <strong>hide<\/strong> the current options set (add-on) if either<strong> All of the following rules<\/strong> or <strong>any of them<\/strong> match.<\/p>\n\n\n\n<p>Then set if it has to be:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Selected<\/strong><\/li>\n\n\n\n<li><strong>Not selected<\/strong><\/li>\n\n\n\n<li><strong>Empty<\/strong><\/li>\n\n\n\n<li><strong>Not empty<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Let&#8217;s give an example to clarify how these rules work.<\/p>\n\n\n\n<h4 class=\"wp-block-heading has-light-blue-background-color has-background\">Example \u2014 show X if set of options Y is selected<\/h4>\n\n\n\n<p>You offer copywriting as a paid service, but SEO keywords can be added optionally and at an extra cost. <\/p>\n\n\n\n<p>So, use a checkbox to let the user add the extra paid service for SEO keywords, and only if it is flagged, show a textbox where the user can type them in.<\/p>\n\n\n\n<p>Create both options and then, from the <strong>Input text<\/strong> conditional logic, set the display rule like in the following screenshot: <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/21.conditional-logic-example-free.jpg\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" width=\"1474\" height=\"900\" src=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/21.conditional-logic-example-free.jpg\" alt=\"Conditional logic example - free version\" class=\"wp-image-1938\" srcset=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/21.conditional-logic-example-free.jpg 1474w, https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/21.conditional-logic-example-free-300x183.jpg 300w, https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/21.conditional-logic-example-free-1024x625.jpg 1024w, https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/21.conditional-logic-example-free-768x469.jpg 768w\" sizes=\"auto, (max-width: 1474px) 100vw, 1474px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>The conditional logic is extremely useful if you want to hide or show some options based on what the customer selects in another options set. After enabling the creation of display conditions, you will be able to set up the display rules. You can choose whether to show or hide the current options set (add-on) &hellip; <a href=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Conditional logic<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-775","post","type-post","status-publish","format-standard","hentry","category-options-sets-free-version"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>YITH Product Add-Ons: Conditional logic<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"YITH Product Add-Ons: Conditional logic\" \/>\n<meta property=\"og:description\" content=\"The conditional logic is extremely useful if you want to hide or show some options based on what the customer selects in another options set. After enabling the creation of display conditions, you will be able to set up the display rules. You can choose whether to show or hide the current options set (add-on) &hellip; Continue reading Conditional logic\" \/>\n<meta property=\"og:url\" content=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/\" \/>\n<meta property=\"og:site_name\" content=\"YITH WooCommerce Product Add-Ons\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-27T16:58:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-11T11:29:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg\" \/>\n<meta name=\"author\" content=\"ausilia\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ausilia\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/\",\"url\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/\",\"name\":\"YITH Product Add-Ons: Conditional logic\",\"isPartOf\":{\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg\",\"datePublished\":\"2021-05-27T16:58:35+00:00\",\"dateModified\":\"2023-07-11T11:29:48+00:00\",\"author\":{\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#\/schema\/person\/5689fc6012d168000704e80bf26087da\"},\"breadcrumb\":{\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#primaryimage\",\"url\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg\",\"contentUrl\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Conditional logic\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#website\",\"url\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/\",\"name\":\"YITH WooCommerce Product Add-Ons\",\"description\":\"Plugin documentation\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#\/schema\/person\/5689fc6012d168000704e80bf26087da\",\"name\":\"ausilia\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b8d070e41e47a70dee7611c4d905ff05?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b8d070e41e47a70dee7611c4d905ff05?s=96&d=mm&r=g\",\"caption\":\"ausilia\"},\"url\":\"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/author\/ausilia\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"YITH Product Add-Ons: Conditional logic","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:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/","og_locale":"en_US","og_type":"article","og_title":"YITH Product Add-Ons: Conditional logic","og_description":"The conditional logic is extremely useful if you want to hide or show some options based on what the customer selects in another options set. After enabling the creation of display conditions, you will be able to set up the display rules. You can choose whether to show or hide the current options set (add-on) &hellip; Continue reading Conditional logic","og_url":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/","og_site_name":"YITH WooCommerce Product Add-Ons","article_published_time":"2021-05-27T16:58:35+00:00","article_modified_time":"2023-07-11T11:29:48+00:00","og_image":[{"url":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg","type":"","width":"","height":""}],"author":"ausilia","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ausilia","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/","url":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/","name":"YITH Product Add-Ons: Conditional logic","isPartOf":{"@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#website"},"primaryImageOfPage":{"@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#primaryimage"},"image":{"@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#primaryimage"},"thumbnailUrl":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg","datePublished":"2021-05-27T16:58:35+00:00","dateModified":"2023-07-11T11:29:48+00:00","author":{"@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#\/schema\/person\/5689fc6012d168000704e80bf26087da"},"breadcrumb":{"@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#primaryimage","url":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg","contentUrl":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-content\/uploads\/sites\/249\/2023\/07\/20.conditional-logic-options-free.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/conditional-logic\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/"},{"@type":"ListItem","position":2,"name":"Conditional logic"}]},{"@type":"WebSite","@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#website","url":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/","name":"YITH WooCommerce Product Add-Ons","description":"Plugin documentation","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#\/schema\/person\/5689fc6012d168000704e80bf26087da","name":"ausilia","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b8d070e41e47a70dee7611c4d905ff05?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b8d070e41e47a70dee7611c4d905ff05?s=96&d=mm&r=g","caption":"ausilia"},"url":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/author\/ausilia\/"}]}},"_links":{"self":[{"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/posts\/775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/comments?post=775"}],"version-history":[{"count":24,"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/posts\/775\/revisions"}],"predecessor-version":[{"id":1988,"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/posts\/775\/revisions\/1988"}],"wp:attachment":[{"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/media?parent=775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/categories?post=775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.yithemes.com\/yith-woocommerce-product-add-ons\/wp-json\/wp\/v2\/tags?post=775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}