{"id":465,"date":"2023-03-21T16:07:18","date_gmt":"2023-03-21T16:07:18","guid":{"rendered":"https:\/\/help.kybernaut.cz\/help\/useful-snippets\/"},"modified":"2023-03-21T16:07:56","modified_gmt":"2023-03-21T16:07:56","slug":"useful-snippets","status":"publish","type":"ht_kb","link":"https:\/\/help.kybernaut.cz\/en\/help\/useful-snippets\/","title":{"rendered":"Useful snippets"},"content":{"rendered":"\n<p>If you want to add additional functionality to your e-shop, you can also use pieces of code called snippets. These can be added to a child template if you use one, or perhaps with the <a rel=\"noreferrer noopener\" href=\"https:\/\/cs.wordpress.org\/plugins\/code-snippets\/\" target=\"_blank\">Code Snippets<\/a> plugin, which allows you to insert them even if you&#8217;re not a programmer.<\/p>\n\n\n\n<p>Below you will find a few useful ones that may come in handy if you use the <a href=\"https:\/\/kybernaut.cz\/pluginy\/kybernaut-mailstep\/\" target=\"_blank\" rel=\"noreferrer noopener\">Kybernaut Mailstep<\/a> plugin.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Phone validation<\/h2>\n\n\n\n<p>If you don&#8217;t use any of the phone validation plugins, I recommend using at least the basic constraint in the form of this snippet. It verifies the minimum length when sending the data in the Checkout and watches for inappropriate characters in the phone field.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/vyskoczilova\/5325c96bf1b4154fd8ec95e153208d25.js\"><\/script>\n\n\n\n<h2 class=\"wp-block-heading\">Validation of the descriptive number<\/h2>\n\n\n\n<p>The snippet will check if at least one number is present in the first address line &#8211; by which we assume that the sender did not forget to write a descriptive number. Suitable for GLS and other delivery services.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/vyskoczilova\/dbd8cb4d2ca12e40b8ec12af2f0b043a.js\"><\/script>\n","protected":false},"excerpt":{"rendered":"<p>Pieces of code to help you prevent incorrectly filled fields in Checkout.<\/p>\n","protected":false},"author":1,"template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[52,53],"ht-kb-tag":[72,70,78,73],"class_list":["post-465","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-mailstep-en","ht_kb_category-messenger-en","ht_kb_tag-phone","ht_kb_tag-snippet-en","ht_kb_tag-street-number","ht_kb_tag-validation"],"_links":{"self":[{"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb\/465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":4,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb\/465\/revisions"}],"predecessor-version":[{"id":469,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb\/465\/revisions\/469"}],"wp:attachment":[{"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/media?parent=465"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb-category?post=465"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}