R
R
Roman Govorov2019-06-25 12:59:14
WooCommerce
Roman Govorov, 2019-06-25 12:59:14

How to move "payment method" block in Woocommerce?

Now like this:
5d11efd5473af478545597.jpeg
You need to do this:
5d11efe436edf683458976.jpeg
I found the code in the sources (/wp-content/plugins/woocommerce/templates/checkout/form-checkout.php):

<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">

  <?php if ( $checkout->get_checkout_fields() ) : ?>

    <?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>

    <div class="col2-set" id="customer_details">
      <div class="col-1">
        <?php do_action( 'woocommerce_checkout_billing' ); ?>
      </div>

      <div class="col-2">
        <?php do_action( 'woocommerce_checkout_shipping' ); ?>
      </div>
    </div>

    <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>

  <?php endif; ?>
  
  <?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?>
  
  <h3 id="order_review_heading"><?php esc_html_e( 'Your order', 'woocommerce' ); ?></h3>
  
  <?php do_action( 'woocommerce_checkout_before_order_review' ); ?>

  <div id="order_review" class="woocommerce-checkout-review-order">
    <?php do_action( 'woocommerce_checkout_order_review' ); ?>
  </div>

  <?php do_action( 'woocommerce_checkout_after_order_review' ); ?>

</form>

Line <?php do_action( 'woocommerce_checkout_order_review' ); ?>, is responsible for displaying just the same delivery and payment block, I need to transfer the payment to another place, as in the screenshot, how can I do this?
Already broke my head with these add_action() and do_action() ..

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Govorov, 2019-06-25
@RGameShow

edited the file /wp-content/plugins/woocommerce/templates/checkout/form-checkout.php
and dropped it into the theme folder /wp-content/themes/rstheme/woocommerce/checkout/form-checkout.php
It turned out what was required:

<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">

    <?php if ( $checkout->get_checkout_fields() ) : ?>
        <?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
        <div class="row" id="customer_details">
            <div class="col-md-6">
                <?php do_action( 'woocommerce_checkout_billing' ); ?>
            </div>
            <div class="col-md-6">
                <?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?>
                <h3 id="order_review_heading"><?php esc_html_e( 'Your order', 'woocommerce' ); ?></h3>
                <p class="ti-0 h5 text-center pb-3" style="font-size: 15px">Чтобы рассчитать стоимость доставки укажите Ваш город</p>
                <?php do_action( 'woocommerce_checkout_before_order_review' ); ?>

                <div id="order_review" class="woocommerce-checkout-review-order">
                    <?=woocommerce_order_review();?>
                </div>

                <?php do_action( 'woocommerce_checkout_after_order_review' ); ?>

            </div>
        </div>
        <?=woocommerce_checkout_payment();?>
    <?php endif; ?>
</form>

P
Pychev Anatoly, 2019-06-25
@pton

It's already at the bottom of the form (judging by the code you provided), rearrange columns with styles
Look at the functions that are called by these hooks, check the markup.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question