{"id":2237,"date":"2021-05-12T18:08:17","date_gmt":"2021-05-12T18:08:17","guid":{"rendered":"https:\/\/kadencecloud.com\/?post_type=knowledgebase&#038;p=2237"},"modified":"2026-04-22T15:14:19","modified_gmt":"2026-04-22T15:14:19","password":"","slug":"sell-access-keys-woocommerce","status":"publish","type":"docs","link":"https:\/\/www.kadencewp.com\/help-center\/docs\/kadence-cloud\/sell-access-keys-woocommerce\/","title":{"rendered":"How to Sell Access Keys (Woocommerce)"},"content":{"rendered":"\n<p>By default, Kadence Pattern Hub has a built-in simple system to allow you to generate access keys. You can use them for yourself and\/or share them. However, if you want to sell access keys, we recommend using a more robust access key generation tool.  One that integrates with WooCommerce, syncs with a product, and generally provides more control.<\/p>\n\n\n\n<p>Our favorite solution is <a href=\"https:\/\/woosoftwarelicense.com\/\" data-type=\"URL\" data-id=\"https:\/\/woosoftwarelicense.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">WooCommerce Software License<\/a>. It works really well with subscriptions and allows the user to generate keys for themselves. It, however, is not free. Another great option that is free is <a href=\"https:\/\/wordpress.org\/plugins\/license-manager-for-woocommerce\/\" target=\"_blank\" rel=\"noreferrer noopener\">License Manager for WooCommerce<\/a>. In this tutorial, we will cover the basics for both.<\/p>\n\n\n<style>.kadence-column2237_279c1d-7e > .kt-inside-inner-col,.kadence-column2237_279c1d-7e > .kt-inside-inner-col:before{border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;}.kadence-column2237_279c1d-7e > .kt-inside-inner-col{column-gap:var(--global-kb-gap-sm, 1rem);}.kadence-column2237_279c1d-7e > .kt-inside-inner-col{flex-direction:column;}.kadence-column2237_279c1d-7e > .kt-inside-inner-col > .aligncenter{width:100%;}.kadence-column2237_279c1d-7e > .kt-inside-inner-col:before{opacity:0.3;}.kadence-column2237_279c1d-7e{position:relative;}@media all and (max-width: 1024px){.kadence-column2237_279c1d-7e > .kt-inside-inner-col{flex-direction:column;justify-content:center;}}@media all and (max-width: 767px){.kadence-column2237_279c1d-7e > .kt-inside-inner-col{flex-direction:column;justify-content:center;}}<\/style>\n<div class=\"wp-block-kadence-column kadence-column2237_279c1d-7e kvs-lg-false kvs-md-false kvs-sm-false\"><div class=\"kt-inside-inner-col\">\n<p>We have covered the entire setup in a video that goes over the entire setup process.<\/p>\n\n\n<!--presto-player:video_id=1--><figure class=\"wp-block-video presto-block-video  presto-provider-youtube\" style=\"--plyr-color-main: var(--presto-player-highlight-color, #0073e6); --presto-player-logo-width: 150px; \">\n\t<presto-player \n\t\tpreset='{&quot;id&quot;:1,&quot;name&quot;:&quot;Default&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;icon&quot;:&quot;format-video&quot;,&quot;skin&quot;:&quot;modern&quot;,&quot;play-large&quot;:true,&quot;rewind&quot;:true,&quot;play&quot;:true,&quot;fast-forward&quot;:true,&quot;progress&quot;:true,&quot;current-time&quot;:true,&quot;mute&quot;:true,&quot;volume&quot;:true,&quot;speed&quot;:false,&quot;pip&quot;:false,&quot;fullscreen&quot;:true,&quot;captions&quot;:false,&quot;reset_on_end&quot;:true,&quot;auto_hide&quot;:true,&quot;captions_enabled&quot;:false,&quot;save_player_position&quot;:true,&quot;sticky_scroll&quot;:false,&quot;sticky_scroll_position&quot;:&quot;bottom right&quot;,&quot;on_video_end&quot;:&quot;select&quot;,&quot;play_video_viewport&quot;:false,&quot;hide_youtube&quot;:false,&quot;lazy_load_youtube&quot;:false,&quot;hide_logo&quot;:false,&quot;border_radius&quot;:0,&quot;caption_style&quot;:&quot;&quot;,&quot;caption_background&quot;:&quot;&quot;,&quot;is_locked&quot;:true,&quot;cta&quot;:[&quot;&quot;],&quot;watermark&quot;:[&quot;&quot;],&quot;email_collection&quot;:[&quot;&quot;],&quot;action_bar&quot;:[&quot;&quot;],&quot;created_by&quot;:1265,&quot;created_at&quot;:&quot;2023-01-09 22:37:49&quot;,&quot;updated_at&quot;:&quot;2023-01-09 22:37:49&quot;,&quot;deleted_at&quot;:&quot;&quot;,&quot;search&quot;:[&quot;&quot;],&quot;show_time_elapsed&quot;:false}'\n\t\tbranding='{&quot;logo&quot;:&quot;&quot;,&quot;color&quot;:&quot;#0073e6&quot;,&quot;logo_width&quot;:150,&quot;player_css&quot;:&quot;&quot;}'\n\t\tchapters='[]'\n\t\toverlays='[]'\n\t\ttracks='[]'\n\t\tblock-attributes='{&quot;playsInline&quot;:true,&quot;id&quot;:1,&quot;src&quot;:&quot;https:\\\/\\\/www.youtube.com\\\/watch?v=NRlWjeN6frQ&quot;,&quot;preset&quot;:1,&quot;video_id&quot;:&quot;NRlWjeN6frQ&quot;,&quot;visibility&quot;:&quot;public&quot;,&quot;color&quot;:&quot;#00b3ff&quot;,&quot;mutedPreview&quot;:{&quot;enabled&quot;:false,&quot;captions&quot;:false},&quot;mutedOverlay&quot;:{&quot;enabled&quot;:false,&quot;src&quot;:&quot;&quot;,&quot;width&quot;:200,&quot;focalPoint&quot;:{&quot;x&quot;:0.5,&quot;y&quot;:0.5}},&quot;mutedOverlayType&quot;:&quot;text&quot;,&quot;mutedOverlayText&quot;:&quot;Click to play&quot;,&quot;mutedOverlayImageWidth&quot;:200,&quot;chapters&quot;:[],&quot;overlays&quot;:[],&quot;tracks&quot;:[],&quot;title&quot;:&quot;How To Sell Access To Your WordPress Design Library On Kadence Cloud&quot;}'\n\t\tanalytics=''\n\t\tautomations\t\tprovider='youtube'\n\t\t\t\tid=\"presto-player-1\"\n\t\tsrc=\"\/\/www.youtube.com\/embed\/NRlWjeN6frQ?iv_load_policy=3&amp;modestbranding=1&amp;playinline=1&amp;showinfo=0&amp;rel=0&amp;enablejsapi=1\"\n\t\tmedia-title=\"How To Sell Access To Your WordPress Design Library On Kadence Cloud\"\n\t\tcss=\"\"\n\t\tclass=\"presto-video-id-1 presto-preset-id-1 skin-modern\"\n\t\tskin=\"modern\" \n\t\ticon-url=\"https:\/\/www.kadencewp.com\/help-center\/wp-content\/plugins\/presto-player\/img\/sprite.svg\" \n\t\tpreload=\"\" \n\t\tposter=\"\"\n\t\tyoutube=\"{&quot;noCookie&quot;:false,&quot;channelId&quot;:&quot;&quot;,&quot;show_count&quot;:false}\"\n\t\tprovider-video-id=\"NRlWjeN6frQ\"\n\t\tvideo-id=\"1\"\n\t\t\t\tplaysinline \n\t\t\t\t>\n\t\t\n    <div class=\"presto-iframe-fallback-container\">\n        <iframe style=\"width: 100%\" title=\"Youtube Video\" class=\"presto-fallback-iframe\" id=\"presto-iframe-fallback-1\" data-src=\"https:\/\/www.youtube.com\/embed\/NRlWjeN6frQ?iv_load_policy=3&amp;modestbranding=1&amp;playsinline=1&amp;showinfo=0&amp;rel=0&amp;enablejsapi=1\" allowfullscreen allowtransparency allow=\"autoplay\"><\/iframe>\n    <\/div>\n\n\t<\/presto-player>\n<\/figure><\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1. Create your Pattern Hub Access Product<\/h2>\n\n\n\n<p>In this tutorial, we won&#8217;t cover using WooCommerce Subscriptions, but the process is similar. Create a new product, set it as virtual, and depending on which plugin you are using set up the license configuration.<\/p>\n\n\n<style>.kb-row-layout-id2237_81e82b-fa > .kt-row-column-wrap{align-content:start;}:where(.kb-row-layout-id2237_81e82b-fa > .kt-row-column-wrap) > .wp-block-kadence-column{justify-content:start;}.kb-row-layout-id2237_81e82b-fa > .kt-row-column-wrap{column-gap:var(--global-kb-gap-md, 2rem);row-gap:var(--global-kb-gap-md, 2rem);padding-top:0px;padding-bottom:0px;grid-template-columns:minmax(0, 1fr);}.kb-row-layout-id2237_81e82b-fa > .kt-row-layout-overlay{opacity:0.30;}@media all and (max-width: 1024px){.kb-row-layout-id2237_81e82b-fa > .kt-row-column-wrap{grid-template-columns:minmax(0, 1fr);}}@media all and (max-width: 767px){.kb-row-layout-id2237_81e82b-fa > .kt-row-column-wrap{grid-template-columns:minmax(0, 1fr);}}<\/style><div class=\"kb-row-layout-wrap kb-row-layout-id2237_81e82b-fa alignnone wp-block-kadence-rowlayout\"><div class=\"kt-row-column-wrap kt-has-2-columns kt-row-layout-row kt-tab-layout-inherit kt-mobile-layout-row kt-row-valign-top\">\n<style>.kadence-column2237_ea92a1-44 > .kt-inside-inner-col,.kadence-column2237_ea92a1-44 > .kt-inside-inner-col:before{border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;}.kadence-column2237_ea92a1-44 > .kt-inside-inner-col{column-gap:var(--global-kb-gap-sm, 1rem);}.kadence-column2237_ea92a1-44 > .kt-inside-inner-col{flex-direction:column;}.kadence-column2237_ea92a1-44 > .kt-inside-inner-col > .aligncenter{width:100%;}.kadence-column2237_ea92a1-44 > .kt-inside-inner-col:before{opacity:0.3;}.kadence-column2237_ea92a1-44{position:relative;}@media all and (max-width: 1024px){.kadence-column2237_ea92a1-44 > .kt-inside-inner-col{flex-direction:column;justify-content:center;}}@media all and (max-width: 767px){.kadence-column2237_ea92a1-44 > .kt-inside-inner-col{flex-direction:column;justify-content:center;}}<\/style>\n<div class=\"wp-block-kadence-column kadence-column2237_ea92a1-44 inner-column-1\"><div class=\"kt-inside-inner-col\">\n<p><strong>WooCommerce Software License<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.kadencewp.com\/kadence-cloud\/wp-content\/uploads\/sites\/9\/2021\/05\/access_product-min-1024x504.png\" alt=\"\" class=\"wp-image-2356\" \/><\/figure>\n<\/div><\/div>\n\n\n<style>.kadence-column2237_833830-05 > .kt-inside-inner-col,.kadence-column2237_833830-05 > .kt-inside-inner-col:before{border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;}.kadence-column2237_833830-05 > .kt-inside-inner-col{column-gap:var(--global-kb-gap-sm, 1rem);}.kadence-column2237_833830-05 > .kt-inside-inner-col{flex-direction:column;}.kadence-column2237_833830-05 > .kt-inside-inner-col > .aligncenter{width:100%;}.kadence-column2237_833830-05 > .kt-inside-inner-col:before{opacity:0.3;}.kadence-column2237_833830-05{position:relative;}@media all and (max-width: 1024px){.kadence-column2237_833830-05 > .kt-inside-inner-col{flex-direction:column;justify-content:center;}}@media all and (max-width: 767px){.kadence-column2237_833830-05 > .kt-inside-inner-col{flex-direction:column;justify-content:center;}}<\/style>\n<div class=\"wp-block-kadence-column kadence-column2237_833830-05 inner-column-2\"><div class=\"kt-inside-inner-col\">\n<p><strong>License Manager for WooCommerce<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.kadencewp.com\/kadence-cloud\/wp-content\/uploads\/sites\/9\/2021\/05\/product_license-min-1024x373.png\" alt=\"\" class=\"wp-image-2357\" \/><\/figure>\n<\/div><\/div>\n\n<\/div><\/div>\n\n\n<h2 class=\"wp-block-heading\">Step 2. Connect Kadence Pattern Hub to License Check<\/h2>\n\n\n\n<p>For this step, you need to add a custom PHP filter depending on which license manager plugin you are using. For that, I suggest using a <a rel=\"noreferrer noopener\" href=\"https:\/\/kadence-theme.com\/knowledge-base\/advanced\/how-to-add-a-custom-filter-or-function-with-code-snippets\/\" data-type=\"URL\" data-id=\"https:\/\/kadence-theme.com\/knowledge-base\/advanced\/how-to-add-a-custom-filter-or-function-with-code-snippets\/\" target=\"_blank\">code snippet plugin<\/a> to add the PHP filter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">WooCommerce Software License Filter Setup<\/h3>\n\n\n\n<p>The PHP filter below will check if the license is valid and if it&#8217;s activated for the domain of the requested site. If it&#8217;s activated, then it will return true and if it&#8217;s not yet been activated for the domain it will try to activate. If the key is not valid or is already used on the maximum number of sites, it will prevent access.<\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>*NOTE: Be sure to change out PRODUCT_UNIQUE_ID with the Unique ID you set when creating your product in the license configuration (line 22).<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php line-numbers\">\/**\n * Validates license with WooCommerce Software License.\n *\n * @param Boolean         $access true or false based on access.\n * @param String          $key the access key.\n * @param WP_REST_Request $request full details about the request.\n * @return Boolean based on if access should be granted.\n *\/\nfunction custom_check_cloud_access( $access, $key, $request ) {\n\t\/\/ If true the key matches with settings in Kadence Pattern Hub. Let that pass for testing purposes.\n\tif ( $access ) {\n\t\treturn $access;\n\t}\n\t\/\/ Make sure WooCommerce Software License exists.\n\tglobal $WOO_SL_API;\n\tif ( $WOO_SL_API ) {\n\t\t$site = preg_replace('(^https?:\/\/)', '', $request-&gt;get_param( 'site' ) );\n\t\t$args =   array(\n\t\t\t'licence_key'       =&gt; $key,\n\t\t\t'domain'            =&gt; $site,\n\t\t\t'woo_sl_action'     =&gt; 'status-check',\n\t\t\t'product_unique_id' =&gt; 'PRODUCT_UNIQUE_ID',\n\t\t);\n\t\t$response = $WOO_SL_API-&gt;API_call( $args );\n\t\t$response = json_decode( $response );\n\t\tend( $response );\n\t\t$response_data = current( $response );\n\t\tif ( is_object( $response_data ) &amp;&amp; 'success' === $response_data-&gt;status ) {\n\t\t\t\/\/ Lets activate it for this domain if it's not.\n\t\t\tif ( $response_data-&gt;status_code &amp;&amp; 's203' === $response_data-&gt;status_code ) {\n\t\t\t\t$args['woo_sl_action'] = 'activate';\n\t\t\t\t$response = $WOO_SL_API-&gt;API_call( $args );\n\t\t\t}\n\t\t\treturn true;\n\t\t} else if ( is_object( $response_data ) &amp;&amp; 'error' === $response_data-&gt;status ) {\n\t\t\t\/\/ Lets activate it for this domain if possible.\n\t\t\tif ( $response_data-&gt;status_code &amp;&amp; 'e204' === $response_data-&gt;status_code ) {\n\t\t\t\t$args['woo_sl_action'] = 'activate';\n\t\t\t\t$response = $WOO_SL_API-&gt;API_call( $args );\n\t\t\t\t$response = json_decode( $response );\n\t\t\t\tend( $response );\n\t\t\t\t$response_data = current( $response );\n\t\t\t\tif ( is_object( $response_data ) &amp;&amp; 'success' === $response_data-&gt;status ) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn $access;\n}\nadd_filter( 'kadence_cloud_rest_request_access', 'custom_check_cloud_access', 10, 3 );<\/code><\/pre>\n\n\n\n<p>If you want to limit your WooCommerce Software License access keys to a specific collection in your Pattern Hub, you can do that using the following filter. You will just need to replace the &#8220;COLLECTION_SLUG&#8221; on line 4 with the slug you want to send.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php line-numbers\">\/**\n * Set access to a specific pattern hub library collection.\n *\n * @param array  $args the query args for retrieving items.\n * @param string $key the access key.\n * @param array  $request_extras the extra args for the request.\n * @return array with updated query args.\n *\/\nfunction custom_kadence_cloud_query_args( $args, $key, $request_extras ) {\n\tif ( ! isset( $args['tax_query'] ) ) {\n\t\t$args['tax_query'] = array(\n\t\t\tarray(\n\t\t\t\t'taxonomy' =&gt; 'kadence-cloud-collections',\n\t\t\t\t'field' =&gt; 'slug',\n\t\t\t\t'terms' =&gt; array( 'COLLECTION_SLUG' ),\n\t\t\t),\n\t\t);\n\t}\n\treturn $args;\n}\nadd_filter( 'kadence_cloud_template_query_args', 'custom_kadence_cloud_query_args', 10, 3 );<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Selling Multiple Collections with WooCommerce Software License<\/h2>\n\n\n\n<p>Let&#8217;s say you have more than one collection that you want to sell on your site. An easy way to accomplish this is by defining custom prefixes per product license generation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/www.kadencewp.com\/kadence-cloud\/wp-content\/uploads\/sites\/9\/2021\/05\/license_prefix.jpg\" alt=\"\" class=\"wp-image-2454\" style=\"width:843px;height:505px\" \/><\/figure>\n\n\n\n<p>Now, we will change out the two functions above to match up our license keys with the correct collection. For this example, the first collection is going to have a slug of COLLECTION_ONE, and the second collection is going to have a slug of COLLECTION_TWO. The license generator for collection one is going to have a prefix of col_one, and the license generator for collection two is going to have a prefix of col_two. Finally, the Unique product IDs also have to be connected, so for collection one in this example, the product ID is PRODUCT_UNIQUE_ID, and for collection two, it&#8217;s PRODUCT_UNIQUE_ID_TWO.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php line-numbers\">\/**\n * Validates license with WooCommerce Software License.\n *\n * @param Boolean         $access true or false based on access.\n * @param String          $key the access key.\n * @param WP_REST_Request $request full details about the request.\n * @return Boolean based on if access should be granted.\n *\/\nfunction custom_check_cloud_access( $access, $key, $request ) {\n\t\/\/ If true the key matches with settings in Kadence Pattern Hub. Let that pass for testing purposes.\n\tif ( $access ) {\n\t\treturn $access;\n\t}\n\t\/\/ Make sure WooCommerce Software License exists.\n\tglobal $WOO_SL_API;\n\tif ( $WOO_SL_API ) {\n\t\tif ( substr( $key, 0, strlen( 'col_one' ) ) === 'col_one' ) {\n\t\t\t$product_id = 'PRODUCT_UNIQUE_ID';\n\t\t} else {\n\t\t\t$product_id = 'PRODUCT_UNIQUE_ID_TWO';\n\t\t}\n\t\t$site = preg_replace('(^https?:\/\/)', '', $request-&gt;get_param( 'site' ) );\n\t\t$args =   array(\n\t\t\t'licence_key'       =&gt; $key,\n\t\t\t'domain'            =&gt; $site,\n\t\t\t'woo_sl_action'     =&gt; 'status-check',\n\t\t\t'product_unique_id' =&gt; $product_id,\n\t\t);\n\t\t$response = $WOO_SL_API-&gt;API_call( $args );\n\t\t$response = json_decode( $response );\n\t\tend( $response );\n\t\t$response_data = current( $response );\n\t\tif ( is_object( $response_data ) &amp;&amp; 'success' === $response_data-&gt;status ) {\n\t\t\t\/\/ Lets activate it for this domain if it's not.\n\t\t\tif ( $response_data-&gt;status_code &amp;&amp; 's203' === $response_data-&gt;status_code ) {\n\t\t\t\t$args['woo_sl_action'] = 'activate';\n\t\t\t\t$response = $WOO_SL_API-&gt;API_call( $args );\n\t\t\t}\n\t\t\treturn true;\n\t\t} else if ( is_object( $response_data ) &amp;&amp; 'error' === $response_data-&gt;status ) {\n\t\t\t\/\/ Lets activate it for this domain if possible.\n\t\t\tif ( $response_data-&gt;status_code &amp;&amp; 'e204' === $response_data-&gt;status_code ) {\n\t\t\t\t$args['woo_sl_action'] = 'activate';\n\t\t\t\t$response = $WOO_SL_API-&gt;API_call( $args );\n\t\t\t\t$response = json_decode( $response );\n\t\t\t\tend( $response );\n\t\t\t\t$response_data = current( $response );\n\t\t\t\tif ( is_object( $response_data ) &amp;&amp; 'success' === $response_data-&gt;status ) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn $access;\n}\nadd_filter( 'kadence_cloud_rest_request_access', 'custom_check_cloud_access', 10, 3 );<\/code><\/pre>\n\n\n\n<p>Next we want to limit access to the correct collection based on the license key. We can do that with the following function.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php line-numbers\">\/**\n * Set access to a specific pattern hub library collection.\n *\n * @param array  $args the query args for retrieving items.\n * @param string $key the access key.\n * @param array  $request_extras the extra args for the request.\n * @return array with updated query args.\n *\/\nfunction custom_kadence_cloud_query_args( $args, $key, $request_extras ) {\n\tif ( substr( $key, 0, strlen( 'col_one' ) ) === 'col_one' ) {\n\t\t$args['tax_query'] = array(\n\t\t\tarray(\n\t\t\t\t'taxonomy' =&gt; 'kadence-cloud-collections',\n\t\t\t\t'field' =&gt; 'slug',\n\t\t\t\t'terms' =&gt; array( 'COLLECTION_ONE' ),\n\t\t\t),\n\t\t);\n\t} else {\n\t\t$args['tax_query'] = array(\n\t\t\tarray(\n\t\t\t\t'taxonomy' =&gt; 'kadence-cloud-collections',\n\t\t\t\t'field' =&gt; 'slug',\n\t\t\t\t'terms' =&gt; array( 'COLLECTION_TWO' ),\n\t\t\t),\n\t\t);\n\t}\n\treturn $args;\n}\nadd_filter( 'kadence_cloud_template_query_args', 'custom_kadence_cloud_query_args', 10, 3 );<\/code><\/pre>\n\n\n<style>.wp-block-kadence-spacer.kt-block-spacer-2237_e15e0b-f5 .kt-block-spacer{height:60px;}.wp-block-kadence-spacer.kt-block-spacer-2237_e15e0b-f5 .kt-divider{border-top-width:1px;height:1px;border-top-color:#eee;width:80%;border-top-style:solid;}<\/style>\n<div class=\"wp-block-kadence-spacer aligncenter kt-block-spacer-2237_e15e0b-f5\"><div class=\"kt-block-spacer kt-block-spacer-halign-center\"><hr class=\"kt-divider\" \/><\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">License Manager for WooCommerce filter setup<\/h3>\n\n\n\n<p>The PHP filter below will check if the license is valid. It won&#8217;t be able to check based on a maximum number of sites but more simply to see if the license is valid or not.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php line-numbers\">\/**\n * Validates license with license manager for woocommerce.\n *\n * @param Boolean         $access true or false based on access.\n * @param String          $key the access key.\n * @param WP_REST_Request $request full details about the request.\n * @return Boolean based on if access should be granted.\n *\/\nfunction custom_check_cloud_access( $access, $key, $request ) {\n\t\/\/ If true the key matches with settings in Kadence Cloud.\n\tif ( $access ) {\n\t\treturn $access;\n\t}\n\t\/\/ Make sure license manager for woocommerce exists.\n\tif ( class_exists( 'LicenseManagerForWooCommerce\\Repositories\\Resources\\License' ) ) {\n\t\t$license = \\LicenseManagerForWooCommerce\\Repositories\\Resources\\License::instance()-&gt;findBy(\n\t\t\tarray( 'hash' =&gt; apply_filters( 'lmfwc_hash', $key ) )\n\t\t);\n\t\tif ( ! $license ) {\n\t\t\t\/\/ No license was found.\n\t\t\treturn false;\n\t\t} else {\n\t\t\t\/\/ Check if expired.\n\t\t\t$expiresAt = $license-&gt;getExpiresAt();\n\t\t\t$dateExpiresAt = new DateTime($expiresAt);\n\t\t\t$dateNow = new DateTime('now', new DateTimeZone('UTC'));\n\t\t\tif ( $dateNow &lt; $dateExpiresAt ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\/\/ Make sure it shows \"activated\".\n\t\t\tif ( intval( $license-&gt;getTimesActivated() ) &lt; 1 ) {\n\t\t\t\t$timesActivatedNew = 1;\n\t\t\t\t$updatedLicense = \\LicenseManagerForWooCommerce\\Repositories\\Resources\\License::instance()-&gt;update(\n\t\t\t\t\t$license-&gt;getId(),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'times_activated' =&gt; $timesActivatedNew\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\t\/\/ We have success lets return true.\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn $access;\n}\nadd_filter( 'kadence_cloud_rest_request_access', 'custom_check_cloud_access', 10, 3 );<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>By default, Kadence Pattern Hub has a built-in simple system to allow you to generate access keys. You can use them for yourself and\/or share them. However, if you want to sell access keys, we recommend using a more robust access key generation tool. One that integrates with WooCommerce, syncs with a product, and generally&#8230;<\/p>\n","protected":false},"author":1265,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"doc_category":[414],"doc_tag":[],"knowledge_base":[10],"class_list":["post-2237","docs","type-docs","status-publish","hentry","doc_category-cloud-selling-access","knowledge_base-kadence-cloud"],"year_month":"2026-04","word_count":1513,"total_views":"5241","reactions":{"happy":"2","normal":"0","sad":"1"},"author_info":{"display_name":"Ben Ritner","author_link":"https:\/\/www.kadencewp.com\/help-center\/author\/britner\/"},"doc_category_info":[{"term_name":"Selling Access","term_url":"https:\/\/www.kadencewp.com\/help-center\/knowledge-base\/kadence-cloud\/cloud-selling-access\/"}],"doc_tag_info":[],"knowledge_base_info":[{"term_name":"Kadence Pattern Hub","term_url":"https:\/\/www.kadencewp.com\/help-center\/knowledge-base\/kadence-cloud\/","term_slug":"kadence-cloud"}],"knowledge_base_slug":["kadence-cloud"],"taxonomy_info":{"doc_category":[{"value":414,"label":"Selling Access"}],"knowledge_base":[{"value":10,"label":"Kadence Pattern Hub"}]},"featured_image_src_large":false,"comment_info":0,"_links":{"self":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs\/2237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/users\/1265"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/comments?post=2237"}],"version-history":[{"count":10,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs\/2237\/revisions"}],"predecessor-version":[{"id":15638,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs\/2237\/revisions\/15638"}],"wp:attachment":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/media?parent=2237"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/doc_category?post=2237"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/doc_tag?post=2237"},{"taxonomy":"knowledge_base","embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/knowledge_base?post=2237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}