In WooCommerce checkboxes have always a value of ‘1’.
So you do not need to pass 'value' => true: it does nothing.
To set checkbox checked or not WooCommerce uses the WP checked function where 1 (integer) is compared with the value you pass as third param in woocommerce_form_field.
Pass 1 as default and your checkbox will be checked as default.
$checked = $checkout->get_value( 'my_checkbox1' ) ? $checkout->get_value( 'my_checkbox1' ) : 1;
woocommerce_form_field( 'my_checkbox1', array(
'type' => 'checkbox',
'class' => array('input-checkbox'),
'label' => __('Standard Shipping (2–7 Days, FREE!) <span>Most items are shipped FREE OF CHARGE within Thailand.</span>'),
'required' => false,
), $checked );
Related Posts:
- Best way to include wp-config.php
- Custom Post Type Templates from Plugin Folder?
- Disable update notification for individual plugins
- How to prevent a post from being deleted?
- Best Practice for Referencing the Plugin Directory
- Managing WP Core & Plugin Updates for Clients
- Query Posts by Custom Field ‘Price’
- How do I create an HTML embed code to publish WP posts on other non-WP websites?
- Selling WordPress sites?
- How to make WordPress use protocol indepentent upload files?
- Cron Job not working in plugin
- How to get all attachment image from post ?? WordPress
- How to check if I am displaying categories on a Woocommerce page? [closed]
- What plugin should I use for a basic user signup/login system [closed]
- How to avoid redefining requirejs in plugin when another plugin also uses requirejs
- Review plugin with rating of post [closed]
- Can I use the same textdomain in two separate plugins?
- Hook to generate a dynamic sitemap with “All in One SEO Pack” Plugin
- Displaying a Welcome Message to a Woocommerce User
- How use %like% in sql statement wordpress
- Can I use a form in a dashboard widget?
- Possible to replicate economist.com’s debate section in wordpress? [closed]
- Why slash is removed after domain?
- add mediaelement.js plugins into WordPress video player control bar
- MITM risk of not sanitizing?
- WordPress Central User Database
- Why Won’t Exported Blog From One Site Import Into New Site?
- Any built-in function to associate a post to category through a plugin?
- Filtering WooCommerce Orders by Category
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- Suggestions on Approach to New Plugin I’m Stuck On
- How to redirect users to their profile after they successfully edit their profile
- Disable Gravatars in WordPress
- Does WP delete deprecated plugin/theme files on plugin/theme upgrade?
- How to check if a taxonomy not exists in a plugin
- wordpress add_action() issue in ajax call
- WordPress plugin won’t show on some themes
- Turning on output buffering in a wordpress plugin
- Is there a plugin for uploading files such as PDF files?
- Register google jquery gets overwritten by plugin
- How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()
- Location dependent rendering of locations? [closed]
- get_comments_number() giving wrong results! What are alternatives?
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- Unable to give correct path in wordpress
- Disable variations on woo commerce if out of stock
- Add wordpress user database on android app
- Grab ID from post from plugin and use it to create an object
- How to add img into a plugin?
- Help with a function in a widget
- Is wp_deregister_script the best way to deal with unneeded plugins in a page?
- PHP mobile redirect Endless loop
- Error: Can´t access facebook comment plugin admin page
- Is there a way to keep youtube videos from displaying on home page, and display only on single posts?
- Cache plugin for medium traffic news blog
- Deregistering and registering javascript breaks plugin
- how to convert XML from URL to HTML
- i want to rewrite my custom plugin url
- [Plugin: WordPress.com Stats] Javascript not being added to footer
- Strange Cached File in Super Cache
- Wp-minify doesn’t seem to minify my JS code
- eaccelerator PHP error
- Strange admin-ajax / CSS / $_SESSION issue
- How to hide plugin submenu title in drop down in admin panel in wordpress?
- Best approach to make all tags searchable by the wordpress search function
- Fail on admin_enqueue_scripts when I try it to upload a CSS file to my WordPress Plugin
- Post source link plugin – small modification
- Can we hide a certain user in WP?
- Enqueue plugin for specific pages
- Why Custom fields description is not working WordPress Version 5.4.2?
- Hooking into the HTML header container
- Problem Advanced Custom Fields PRO
- Block plugin update possibilities (but not by hiding notifications)
- Execute function activate/deactivate plugin in specific pages
- Why can I not deregister my style and script on custom post type?
- Unmatch plugin from updates?
- Using multi-dimensional array with filter
- PHP header() not available to use in my plugin
- Why can’t I shove an instance of a class into a variable from a do_action hook?
- WordPress doesn’t save a post revision when changing CMB2 custom fields
- database – multiple wordpress installations using same database – can they share plugin settings?
- Displaying friend’s posts only
- Display dashboard other than admin user
- Plugin Installation Error
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- Creating themes using the one Plugin (Toolkit)
- How change menu for each user in plugin?
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Facebook meta tags not working properly on WordPress Site
- is there a plugin that allow editing pages from within pages without entering admin panel?
- Ajax not working for logged in users
- Site is setup statically – how to make it content managable?
- How to show in front End images using Visual Composer attach_images?
- Modifying lightbox plugin to allow for quoting, Does this exist? [closed]
- How to escape html code?
- Issues with creating user profile for a subscriber, but with different profile page and functionalities
- Block Root REST API Route using custom &/or iThemes
- How to set an exact search box in tablepress plug-in
- add custom filter to plugins page?