AI Verified

Name

Saves and shows acceptance of terms and conditions - Saves acceptance in the metadata of each order

About

Ingles - Saves and shows acceptance of terms and conditions - Saves acceptance in the metadata of each order Portugues - Salva e mostre a aceitação dos Termos e condições em cada Encomenda (Pedido)

Language

PHP

Rating

Voted: 1 by 1 user(s)

How to Setup Snippet

The code was made to be used in Woocommerce, and is in Portuguese. Just translate and put the data in another language, respectively: ('Aceites') and ('Termos & Condições') Ingles - ('Accepts') and ('Terms & Conditions')

Codevault

hotideias

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

09/04/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Potential vulnerability found : Cross Site Scripting
Found on line : 14
Code : echo('<p><strong>'.__('Termos & Condições').':</strong> ' . $terms_status . '</p>')
Vulnerable line : 14
Code : $terms_status = ( $terms == 'on' ? __('Aceites') : __('undefined') ));

Found 1 vulnerabilities

Saves and shows acceptance of terms and conditions - Saves acceptance in the metadata of each order

 
                    
1/**
2 * Store terms and conditions value within the database
3 **/
4add_action('woocommerce_checkout_update_order_meta', 'woo_save_terms_and_conditions_status');
5 
6function woo_save_terms_and_conditions_status( $order_id ) {
7 if ($_POST['terms']) update_post_meta( $order_id, '_terms', esc_attr($_POST['terms']));
8}
9 
10add_action( 'woocommerce_admin_order_data_after_billing_address', 'woo_display_terms_and_conditions_status', 10, 1 );
11 
12function woo_display_terms_and_conditions_status($order){
13 $terms = get_post_meta( $order->id, '_terms', true );
14 $terms_status = ( $terms == 'on' ? __('Aceites') : __('undefined') );
15 echo '<p><strong>'.__('Termos & Condições').':</strong> ' . $terms_status . '</p>';
16}

1

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

Hide shipping rates when free shipping is available.

Added: 1 year ago

Last Updated: 1 year ago

Why should shipping costs be displayed when free shipping is available for a product? This WooCommerce snippet hides the shipping costs.

WooCommerce

AI Verified

0

WooCommerce Move Product Category Description Below Product Loop

Added: 1 year ago

Last Updated: 1 year ago

This snippet will allow you to move your product description below the loop of products.

WooCommerce

Pro Verified

1

Adjust betwee Shipping Types based on the WooCommerce Cost Total

Added: 1 year ago

Last Updated: 1 year ago

When the cost is > $100 then Free Shipping applies. Less than that has Flat Rate. The numbers are based on the order in the Woo > Settings > Shipping Page

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WooCommerce

AI Verified

1

Saves and shows acceptance of terms and conditions - Saves acceptance in the metadata of each order

Added: 1 year ago

Last Updated: 1 year ago

Ingles - Saves and shows acceptance of terms and conditions - Saves acceptance in the metadata of each order Portugues - Salva e mostre a aceitação dos Termos e condições em cada Encomenda (Pedido)