{"id":424,"date":"2026-09-07T05:04:06","date_gmt":"2026-09-07T05:04:06","guid":{"rendered":"https:\/\/shapekode.com\/product\/optionfroge\/docs\/optionfroge-documentation\/conditional-logic\/"},"modified":"2026-10-26T11:02:27","modified_gmt":"2026-10-26T11:02:27","slug":"conditional-logic","status":"publish","type":"docs","link":"https:\/\/shapekode.com\/product\/shapeoptions\/docs\/optionfroge-documentation\/conditional-logic\/","title":{"rendered":"Conditional logic"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\" style=\"font-size:19px\">Conditional logic shows a field \u2014 or a whole section \u2014 only when the shopper\u2019s other answers call for it. Rules are checked live in the browser and again on the server.<\/p>\n\n\n\n<div style=\"margin:28px 0;padding:18px 22px;border-radius:12px;background:#fff4e5;border-left:5px solid #ea580c\"><p style=\"margin:0 0 6px;font-weight:700;color:#ea580c;font-size:13px;letter-spacing:.06em;text-transform:uppercase\">Pro feature<\/p><div style=\"margin:0;color:#374151;font-size:16px;line-height:1.65\">Conditional logic is part of ShapeOption Pro.<\/div><\/div>\n\n\n\n<div style=\"margin:6px 0 30px;padding:14px 18px;border:1px dashed #e5e7eb;border-radius:12px;background:#f8fafc\"><p style=\"margin:0 0 8px;font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#6b7280\">On this page<\/p><p style=\"margin:0;line-height:2\"><span style=\"display:inline-block;margin:0 8px 0 0;padding:2px 10px;border-radius:999px;background:#fff;border:1px solid #e5e7eb;font-size:14px;color:#374151\">Add a rule<\/span><span style=\"display:inline-block;margin:0 8px 0 0;padding:2px 10px;border-radius:999px;background:#fff;border:1px solid #e5e7eb;font-size:14px;color:#374151\">Operators<\/span><span style=\"display:inline-block;margin:0 8px 0 0;padding:2px 10px;border-radius:999px;background:#fff;border:1px solid #e5e7eb;font-size:14px;color:#374151\">Nested rule groups<\/span><span style=\"display:inline-block;margin:0 8px 0 0;padding:2px 10px;border-radius:999px;background:#fff;border:1px solid #e5e7eb;font-size:14px;color:#374151\">Hide a whole section<\/span><span style=\"display:inline-block;margin:0 8px 0 0;padding:2px 10px;border-radius:999px;background:#fff;border:1px solid #e5e7eb;font-size:14px;color:#374151\">How hidden fields behave<\/span><span style=\"display:inline-block;margin:0 8px 0 0;padding:2px 10px;border-radius:999px;background:#fff;border:1px solid #e5e7eb;font-size:14px;color:#374151\">Tips<\/span><\/p><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Add a rule<\/h2>\n\n\n\n<div style=\"margin:24px 0\"><div style=\"display:flex;gap:16px;align-items:flex-start;padding:16px 18px;margin:0 0 12px;border:1px solid #e5e7eb;border-radius:12px;background:#fff\"><div style=\"flex:0 0 34px;height:34px;border-radius:50%;background:#4f46e5;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:15px\">1<\/div><div style=\"flex:1;min-width:0\"><p style=\"margin:4px 0 4px;font-weight:700;color:#111827;font-size:17px\">Open the field to show or hide<\/p><div style=\"margin:0;color:#374151;font-size:15.5px;line-height:1.65\">Click its card, then the <strong style=\"color:#111827\">Conditional Logic<\/strong> tab.<\/div><\/div><\/div><div style=\"display:flex;gap:16px;align-items:flex-start;padding:16px 18px;margin:0 0 12px;border:1px solid #e5e7eb;border-radius:12px;background:#fff\"><div style=\"flex:0 0 34px;height:34px;border-radius:50%;background:#4f46e5;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:15px\">2<\/div><div style=\"flex:1;min-width:0\"><p style=\"margin:4px 0 4px;font-weight:700;color:#111827;font-size:17px\">Turn it on<\/p><div style=\"margin:0;color:#374151;font-size:15.5px;line-height:1.65\">Tick <strong style=\"color:#111827\">Enable conditional logic<\/strong>.<\/div><\/div><\/div><div style=\"display:flex;gap:16px;align-items:flex-start;padding:16px 18px;margin:0 0 12px;border:1px solid #e5e7eb;border-radius:12px;background:#fff\"><div style=\"flex:0 0 34px;height:34px;border-radius:50%;background:#4f46e5;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:15px\">3<\/div><div style=\"flex:1;min-width:0\"><p style=\"margin:4px 0 4px;font-weight:700;color:#111827;font-size:17px\">Choose ALL or ANY<\/p><div style=\"margin:0;color:#374151;font-size:15.5px;line-height:1.65\"><em>Show when ALL rules match<\/em> needs every rule to be true; <em>Show when ANY rule matches<\/em> needs only one.<\/div><\/div><\/div><div style=\"display:flex;gap:16px;align-items:flex-start;padding:16px 18px;margin:0 0 12px;border:1px solid #e5e7eb;border-radius:12px;background:#fff\"><div style=\"flex:0 0 34px;height:34px;border-radius:50%;background:#4f46e5;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:15px\">4<\/div><div style=\"flex:1;min-width:0\"><p style=\"margin:4px 0 4px;font-weight:700;color:#111827;font-size:17px\">Write the rule<\/p><div style=\"margin:0;color:#374151;font-size:15.5px;line-height:1.65\">Pick the other field, an operator, and the value to compare with \u2014 for example <em>Gift wrap \u00b7 equals \u00b7 yes<\/em>.<\/div><\/div><\/div><div style=\"display:flex;gap:16px;align-items:flex-start;padding:16px 18px;margin:0 0 12px;border:1px solid #e5e7eb;border-radius:12px;background:#fff\"><div style=\"flex:0 0 34px;height:34px;border-radius:50%;background:#4f46e5;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:15px\">5<\/div><div style=\"flex:1;min-width:0\"><p style=\"margin:4px 0 4px;font-weight:700;color:#111827;font-size:17px\">Add more if needed<\/p><div style=\"margin:0;color:#374151;font-size:15.5px;line-height:1.65\">Click <strong style=\"color:#111827\">+ Add rule<\/strong> for another rule, or <strong style=\"color:#111827\">+ Add group<\/strong> for a nested group.<\/div><\/div><\/div><div style=\"display:flex;gap:16px;align-items:flex-start;padding:16px 18px;margin:0 0 12px;border:1px solid #e5e7eb;border-radius:12px;background:#fff\"><div style=\"flex:0 0 34px;height:34px;border-radius:50%;background:#4f46e5;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:15px\">6<\/div><div style=\"flex:1;min-width:0\"><p style=\"margin:4px 0 4px;font-weight:700;color:#111827;font-size:17px\">Update the group<\/p><div style=\"margin:0;color:#374151;font-size:15.5px;line-height:1.65\">Open a product page and change the answers to watch the field appear and disappear.<\/div><\/div><\/div><\/div>\n\n\n\n<figure class=\"wp-block-image size-full has-custom-border\"><a href=\"https:\/\/shapekode.com\/product\/optionfroge\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-rules.webp\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1248\" height=\"1106\" src=\"https:\/\/shapekode.com\/product\/optionfroge\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-rules.webp\" alt=\"Conditional logic rules on a field\" class=\"has-border-color wp-image-577\" style=\"border-color:#e5e7eb;border-width:1px;border-radius:12px\" srcset=\"https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-rules.webp 1248w, https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-rules-300x266.webp 300w, https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-rules-1024x907.webp 1024w, https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-rules-768x681.webp 768w, https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-rules-600x532.webp 600w\" sizes=\"(max-width: 1248px) 100vw, 1248px\" \/><\/a><figcaption class=\"wp-element-caption\">(1) Turn it on. (2) ALL or ANY. (3) A rule: field, operator, value. (4) A nested group with its own ANY setting. (5) Role visibility for this field.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Operators<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Operator<\/th><th>Matches when the other field\u2026<\/th><\/tr><\/thead><tbody><tr><td><strong>equals<\/strong><\/td><td>has exactly this value. For a checkbox group: this choice is ticked.<\/td><\/tr><tr><td><strong>does not equal<\/strong><\/td><td>does not have this value.<\/td><\/tr><tr><td><strong>has any value<\/strong><\/td><td>is filled in or has something picked.<\/td><\/tr><tr><td><strong>is empty<\/strong><\/td><td>is left blank.<\/td><\/tr><tr><td><strong>is greater than<\/strong><\/td><td>is a number above this value.<\/td><\/tr><tr><td><strong>is less than<\/strong><\/td><td>is a number below this value.<\/td><\/tr><tr><td><strong>contains<\/strong><\/td><td>includes this text (any case), or has this choice ticked.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Nested rule groups<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When one ALL\/ANY list is not enough, add a group. Each group has its own ALL\/ANY setting and counts as one rule of the list it sits in. Groups can be nested up to three levels deep.<\/p>\n\n\n\n<div style=\"margin:28px 0;padding:18px 22px;border-radius:12px;background:#ecfdf3;border-left:5px solid #16a34a\"><p style=\"margin:0 0 6px;font-weight:700;color:#16a34a;font-size:13px;letter-spacing:.06em;text-transform:uppercase\">Tip<\/p><div style=\"margin:0;color:#374151;font-size:16px;line-height:1.65\">Example: show \u201cExpress printing\u201d when <em>(Size equals XL AND Quantity is greater than 5)<\/em> OR <em>Color equals red<\/em>.<br>Set the top list to <strong>ANY<\/strong>, add a group set to <strong>ALL<\/strong> with the two size and quantity rules, then add the color rule next to the group.<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Hide a whole section<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A Collapsible section field can carry rules too. When its rules do not match, the section and every field under it \u2014 up to the next section \u2014 are hidden.<\/p>\n\n\n\n<div style=\"margin:24px 0\"><div style=\"display:flex;gap:16px;align-items:flex-start;padding:16px 18px;margin:0 0 12px;border:1px solid #e5e7eb;border-radius:12px;background:#fff\"><div style=\"flex:0 0 34px;height:34px;border-radius:50%;background:#4f46e5;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:15px\">1<\/div><div style=\"flex:1;min-width:0\"><p style=\"margin:4px 0 4px;font-weight:700;color:#111827;font-size:17px\">Add a Collapsible section<\/p><div style=\"margin:0;color:#374151;font-size:15.5px;line-height:1.65\">Put it above the fields it should control, for example \u201cEngraving details\u201d.<\/div><\/div><\/div><div style=\"display:flex;gap:16px;align-items:flex-start;padding:16px 18px;margin:0 0 12px;border:1px solid #e5e7eb;border-radius:12px;background:#fff\"><div style=\"flex:0 0 34px;height:34px;border-radius:50%;background:#4f46e5;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:15px\">2<\/div><div style=\"flex:1;min-width:0\"><p style=\"margin:4px 0 4px;font-weight:700;color:#111827;font-size:17px\">Open its Conditional Logic tab<\/p><div style=\"margin:0;color:#374151;font-size:15.5px;line-height:1.65\">Enable conditional logic and add a rule such as <em>Add engraving \u00b7 equals \u00b7 yes<\/em>.<\/div><\/div><\/div><div style=\"display:flex;gap:16px;align-items:flex-start;padding:16px 18px;margin:0 0 12px;border:1px solid #e5e7eb;border-radius:12px;background:#fff\"><div style=\"flex:0 0 34px;height:34px;border-radius:50%;background:#4f46e5;color:#fff;font-weight:700;display:flex;align-items:center;justify-content:center;font-size:15px\">3<\/div><div style=\"flex:1;min-width:0\"><p style=\"margin:4px 0 4px;font-weight:700;color:#111827;font-size:17px\">Update<\/p><div style=\"margin:0;color:#374151;font-size:15.5px;line-height:1.65\">Shoppers who do not want engraving never see the section or its fields.<\/div><\/div><\/div><\/div>\n\n\n\n<figure class=\"wp-block-image size-full has-custom-border\"><a href=\"https:\/\/shapekode.com\/product\/optionfroge\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-section.webp\"><img decoding=\"async\" width=\"1236\" height=\"836\" src=\"https:\/\/shapekode.com\/product\/optionfroge\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-section.webp\" alt=\"A rule on a collapsible section\" class=\"has-border-color wp-image-578\" style=\"border-color:#e5e7eb;border-width:1px;border-radius:12px\" srcset=\"https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-section.webp 1236w, https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-section-300x203.webp 300w, https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-section-1024x693.webp 1024w, https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-section-768x519.webp 768w, https:\/\/shapekode.com\/product\/shapeoptions\/wp-content\/uploads\/2026\/10\/shapeoption-docs-cl-section-600x406.webp 600w\" sizes=\"(max-width: 1236px) 100vw, 1236px\" \/><\/a><figcaption class=\"wp-element-caption\">(1) The section \u201c3. Extras\u201d shows only when Print is not \u201cNo print\u201d. (2) Every field under it \u2014 here the Extras checkbox group \u2014 is hidden with it.<\/figcaption><\/figure>\n\n\n\n<div style=\"margin:28px 0;padding:18px 22px;border-radius:12px;background:#eef2ff;border-left:5px solid #4f46e5\"><p style=\"margin:0 0 6px;font-weight:700;color:#4f46e5;font-size:13px;letter-spacing:.06em;text-transform:uppercase\">Good to know<\/p><div style=\"margin:0;color:#374151;font-size:16px;line-height:1.65\">A section cannot depend on its own fields \u2014 hidden, they would read as empty and keep it hidden forever \u2014 so those fields are not offered in its rules. In the multi-step wizard, a hidden section\u2019s step is skipped.<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">How hidden fields behave<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A hidden field is never required, never charged and never saved with the order.<\/li>\n\n\n\n<li>If a field is shown only by another field that is hidden, it is hidden as well.<\/li>\n\n\n\n<li>The server checks every rule again on Add to Cart, so hidden values sent from the browser are ignored.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Tips<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For choice fields, compare with the choice <strong>value<\/strong> (the Value column), not the label.<\/li>\n\n\n\n<li>Rules can only use fields of the same group.<\/li>\n\n\n\n<li>Number comparisons (greater\/less than) work on Number, Range and Calculation fields.<\/li>\n\n\n\n<li>To show a field only to certain user roles, use <strong>Visible to roles<\/strong> on the same tab \u2014 see <a href=\"https:\/\/shapekode.com\/product\/optionfroge\/docs\/optionfroge-documentation\/targeting-visibility\/\">Where groups appear<\/a>.<\/li>\n<\/ul>\n\n\n","protected":false},"featured_media":0,"parent":418,"menu_order":7,"comment_status":"open","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"nav_title":"","positive":"","negative":"","footnotes":""},"docs_category":[],"class_list":["post-424","docs","type-docs","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/shapekode.com\/product\/shapeoptions\/wp-json\/wp\/v2\/docs\/424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shapekode.com\/product\/shapeoptions\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/shapekode.com\/product\/shapeoptions\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/shapekode.com\/product\/shapeoptions\/wp-json\/wp\/v2\/comments?post=424"}],"version-history":[{"count":4,"href":"https:\/\/shapekode.com\/product\/shapeoptions\/wp-json\/wp\/v2\/docs\/424\/revisions"}],"predecessor-version":[{"id":605,"href":"https:\/\/shapekode.com\/product\/shapeoptions\/wp-json\/wp\/v2\/docs\/424\/revisions\/605"}],"up":[{"embeddable":true,"href":"https:\/\/shapekode.com\/product\/shapeoptions\/wp-json\/wp\/v2\/docs\/418"}],"wp:attachment":[{"href":"https:\/\/shapekode.com\/product\/shapeoptions\/wp-json\/wp\/v2\/media?parent=424"}],"wp:term":[{"taxonomy":"docs_category","embeddable":true,"href":"https:\/\/shapekode.com\/product\/shapeoptions\/wp-json\/wp\/v2\/docs_category?post=424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}