Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Move Checkout Add-ons
<?php
// Reposition Checkout Addons to under Order Notes
function sv_wc_checkout_addons_change_position() {
return 'woocommerce_after_order_notes';
}
add_filter( 'wc_checkout_add_ons_position', 'sv_wc_checkout_addons_change_position' );
@bryceadams

This comment has been minimized.

Copy link

@bryceadams bryceadams commented Oct 7, 2014

@tamarazuk would be great to add a little comment at the top (or in the docs) saying that the <?php should be removed if an error happens / anything breaks.

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Nov 21, 2014

Where exactly should this code be inserted? (in which file?)

@idelfonsog2

This comment has been minimized.

Copy link

@idelfonsog2 idelfonsog2 commented Nov 30, 2014

I have the same question as dennis

@ehenrickson

This comment has been minimized.

Copy link

@ehenrickson ehenrickson commented Jan 25, 2015

Did anyone get an answer on where this code should be inserted?

@MEErskine

This comment has been minimized.

Copy link

@MEErskine MEErskine commented Jan 31, 2015

Ding.. anyone? Anyone? Bueller?

@softy91

This comment has been minimized.

Copy link

@softy91 softy91 commented Feb 2, 2015

Any updates on this?? Would be great to know where this goes please @tamarazuk ! :)

@MEErskine

This comment has been minimized.

Copy link

@MEErskine MEErskine commented Feb 3, 2015

From WooThemes Support: You may place that code in your functions.php file, located in wp-content/themes/your-theme-name/. At the end of the file.

So there you have it. I have tried it and it works!

@dagdavid

This comment has been minimized.

Copy link

@dagdavid dagdavid commented Feb 14, 2015

If I place this code in functions.php it creates and error. Any other way to format this damned add-on?

@MEErskine

This comment has been minimized.

Copy link

@MEErskine MEErskine commented Feb 15, 2015

I added it to the end of my functions.php file and it works great. Just make sure you don't include the first 2 lines. You only want lines 3 thru 8.

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Feb 17, 2015

I really don't know why but it's not working for me!
it adds this line at the top of the website in every page i'm in.

i used line 3-8 and added it to the functions.php of my wordpress theme.

any solutions guys?

@tamarazuk

This comment has been minimized.

Copy link
Owner Author

@tamarazuk tamarazuk commented May 12, 2015

Hi all,

Unfortunately Gist comments don't produce notifications 😦. I've updated the gist to ensure it works with current version of both WordPress and Checkout Add-ons. I have also removed the <?php tag - this used to be required for syntax highlighting but it no longer is 💃

@Viure

This comment has been minimized.

Copy link

@Viure Viure commented Jul 2, 2015

Hi, you can make it work like this (in your child theme functions.php ):

// Move Checkout Addons to under Order Notes
function sv_wc_move_checkout_addons() {
global $wc_checkout_add_ons;
if ( isset( $wc_checkout_add_ons->frontend ) ) {
remove_action( 'woocommerce_checkout_after_customer_details', array( $wc_checkout_add_ons->frontend, 'render_add_ons' ) );
add_action( 'woocommerce_after_order_notes', array( $wc_checkout_add_ons->frontend, 'render_add_ons' ) );
}
}
add_action( 'init', 'sv_wc_move_checkout_addons', 100 );

@mhallor

This comment has been minimized.

Copy link

@mhallor mhallor commented Nov 23, 2015

@tamarazuk I'm having some trouble setting this up, the original code just removes the addons altogether
and while the code provided by @Viure works, it makes the addons appear twice - it seems the remove_action doesn't work properly.

@torcat

This comment has been minimized.

Copy link

@torcat torcat commented Mar 2, 2016

Hi evryone

can someone help me,
if I want to move the checkout addons in to order details-shipping options table under shipping options
what code need to use?
thanks!

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