Forked from xlplugins/move billing address section (any section ) below the gateway
Created
August 17, 2023 06:49
-
-
Save keshav1990/012faedbbba01df58abfaa4c9d7659e1 to your computer and use it in GitHub Desktop.
move billing address section (any section ) below the gateway
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
this snippet Work only if funnel builder 2.13 or Greater and AeroCheckout 3.8.1 or Greater | |
*/ | |
class FunnelKitMoveSectionBelowGateway { | |
private $contained_section_fields = [ 7 => '']; | |
public function __construct() { | |
add_action( 'wfacp_internal_css', [ $this, 'css' ] ); | |
add_action( 'wfacp_template_section_start', [ $this, 'wrapp_html_start' ], 10, 3 ); | |
add_action( 'wfacp_template_section_end', [ $this, 'wrapp_html_end' ], 10, 3 ); | |
add_filter( 'wfacp_display_place_order_buttons', [ $this, 'hide_place_order' ] ); | |
add_action( 'woocommerce_review_order_after_payment', [ $this, 'print_sections' ], 9 ); | |
add_action( 'woocommerce_review_order_after_payment', [ $this, 'print_order_button' ], 12 ); | |
} | |
public function css() { | |
?> | |
<style> | |
body #wfacp-e-form .wfacp_payment .wfacp-section { | |
padding: 0 !important; | |
border: none !important; | |
} | |
</style> | |
<?php | |
} | |
public function wrapp_html_start( $step, $section_index, $section ) { | |
if ( isset( $this->contained_section_fields[ $section_index + 1 ] ) ) { | |
ob_start(); | |
$this->contained_section_fields[ $section_index + 1 ] = 'start'; | |
} | |
} | |
public function wrapp_html_end( $step, $section_index, $section ) { | |
if ( isset( $this->contained_section_fields[ $section_index + 1 ] ) && 'start' == $this->contained_section_fields[ $section_index + 1 ] ) { | |
$this->contained_section_fields[ $section_index + 1 ] = ob_get_clean(); | |
} | |
} | |
public function hide_place_order() { | |
return false; | |
} | |
public function print_sections() { | |
foreach ( $this->contained_section_fields as $html ) { | |
echo $html; | |
} | |
} | |
public function print_order_button() { | |
$order_button_text = apply_filters( 'woocommerce_order_button_text', __( 'Place order', 'woocommerce' ) ); | |
?> | |
<div class="form-row place-order"> | |
<noscript> | |
<?php esc_html_e( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce' ); ?> | |
<br/> | |
<button type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php esc_attr_e( 'Update totals', 'woocommerce' ); ?>"><?php esc_html_e( 'Update totals', 'woocommerce' ); ?></button> | |
</noscript> | |
<?php wc_get_template( 'checkout/terms.php' ); ?> | |
<?php | |
do_action( 'woocommerce_review_order_before_submit' ); | |
do_action( 'wfacp_woocommerce_review_order_before_submit' ); | |
echo apply_filters( 'woocommerce_order_button_html', '<button type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '">' . esc_html( $order_button_text ) . '</button>' ); // @codingStandardsIgnoreLine | |
do_action( 'wfacp_woocommerce_review_order_after_submit' ); | |
do_action( 'woocommerce_review_order_after_submit' ); | |
?> | |
</div> | |
<?php | |
} | |
} | |
new FunnelKitMoveSectionBelowGateway(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment