Do you want to add a checkbox below a specific shipping method in the WooCommerce cart and checkout page? Here is the handy code snippet that will help you.
add_action( 'woocommerce_after_shipping_rate', 'ts_checkout_shipping_additional_field', 20, 2 ); function ts_checkout_shipping_additional_field( $method, $index ) { if( $method->get_id() == 'flat_rate:4' ){ echo '<br> <input type="checkbox" name="shipping_custom_1" id="shipping_custom_1" value="1" class="shipping_method shipping_custom_1"> <label for="shipping_custom_1">Gift Wrapping</label>'; } }
Output
In the following output, the checkbox is added below a specific flat-rate shipping method (‘flat_rate:4’) on the WooCommerce checkout page. This option gives customers the choice to add a special “Gift Wrapping” service to their order during the checkout process
![How to Add a Checkbox Below a Specific Shipping Method in WooCommerce? 1 How to Add a Checkbox Below a Specific Shipping Method in WooCommerce?](https://media.tychesoftwares.com/wp-content/uploads/add-checkbox-below-a-specific-shipping-method-1024x832.png)
Similar to the above functionality, you can also add radio buttons to specific shipping method on WooCommerce checkout that will help you to place radio buttons for ‘local pickup’ to choose a pickup location.