Skip to content

Instantly share code, notes, and snippets.

@dennisnissle
Created June 21, 2018 14:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennisnissle/9e9dbe056c044bf8b5be44a5c994a344 to your computer and use it in GitHub Desktop.
Save dennisnissle/9e9dbe056c044bf8b5be44a5c994a344 to your computer and use it in GitHub Desktop.
Move legal checkboxes right before order submit button (Germanized > 2.X)
<?php
add_action( 'init', 'my_child_move_legal_checkboxes', 50 );
function my_child_move_legal_checkboxes() {
// Remove
remove_action( 'woocommerce_review_order_after_payment', 'woocommerce_gzd_template_render_checkout_checkboxes', 10 );
// Readd before submit button
add_action( 'woocommerce_gzd_review_order_before_submit', 'woocommerce_gzd_template_render_checkout_checkboxes', 10 );
}
@farhadmn
Copy link

farhadmn commented Sep 3, 2019

Hi,
I added the function into Snippet, but now the checkbox is displayed twice.

Unbenannt

@dennisnissle
Copy link
Author

Hi there,

you might need to check your theme - I've tested the snippet with Storefront and couldn't reproduce the problem.

Cheers

@dr771
Copy link

dr771 commented Jul 13, 2020

@vendidero Thanks a million. Works like a sharm.

@webwurm
Copy link

webwurm commented Nov 19, 2020

Sadly - with the classic Storefront theme - I have the same issue as farhadm: The legal checkbox is now above AND under the table.
Screen

@dennisnissle
Copy link
Author

Hi there,

just tested with the latest Storefront version - works like a charm. Are you using a child theme? Did you add the snippet to your child theme's functions.php? Did you try to deactivate one plugin after another to make sure that no compatibility issues happen here?

Cheers

@webwurm
Copy link

webwurm commented Nov 19, 2020

Thank you, I got it to work like this:

add_action( 'init', 'my_child_move_legal_checkboxes', 50 );

function my_child_move_legal_checkboxes() {
	// Remove
	remove_action( 'wpmc-woocommerce_order_review', 'woocommerce_gzd_template_render_checkout_checkboxes', 10 );
	// Right before submit button
	add_action( 'woocommerce_gzd_review_order_before_submit', 'woocommerce_gzd_template_render_checkout_checkboxes', 10 );
}

@Chuvantinh
Copy link

HI Webrum,

why did you write "wpmc-woocommerce_order_review" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment