title: Move Checkout Shipping Options in Woocommerce
body: <p>I am trying the move the shipping options in my woocommerce checkout out of review-order.php and into form-checkout.php</p>
  <p>I have taken the code</p>
  <pre><code>&lt;?php if ( WC()-&gt;cart-&gt;needs_shipping() &amp;&amp; WC()-&gt;cart-&gt;show_shipping() ) : ?&gt;
      &lt;?php do_action( 'woocommerce_review_order_before_shipping' ); ?&gt;
      &lt;?php wc_cart_totals_shipping_html(); ?&gt;
      &lt;?php do_action( 'woocommerce_review_order_after_shipping' ); ?&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  <p>And moved it to my themes form-checkout.php the problem is that it will now not update the shipping when I enter or change the address. This has been accepted as a solution online but I think woocommerce has updated since then.</p>
  <p>I think the problem is that the shipping options are now not updating when update_checkout Ajax is called but I am unsure how to change this.</p>
  <p>Thank You</p>
  <hr />
  <p>EDIT: I think I have an idea of how to do this. I have created a template checkout/shipping-options.php with</p>
  <pre><code>    &lt;?php
  defined( 'ABSPATH' ) || exit;
  ?&gt;
  &lt;div class=&quot;card card-shipping mb-3 woocommerce-checkout-shipping-table&quot;&gt;
                      &lt;div class=&quot;card-header&quot;&gt;
                          Select Shipping
                      &lt;/div&gt;
                      &lt;div class=&quot;card-body &quot;&gt;
                          &lt;?php do_action( 'woocommerce_review_order_before_shipping' ); ?&gt;
                          &lt;?php wc_cart_totals_shipping_html(); ?&gt;
                          &lt;?php do_action( 'woocommerce_review_order_after_shipping' ); ?&gt;
                      &lt;/div&gt;
  &lt;/div&gt;  
  </code></pre>
  <p>Then in my functions.php I have added</p>
  <pre><code>    function woocommerce_checkout_shipping_options( $deprecated = false ) {
          wc_get_template(
              'checkout/shipping-options.php',
              array(
                  'checkout' =&gt; WC()-&gt;checkout(),
              )
          );
      }
  add_action( 'woocommerce_checkout_shipping_option', 'woocommerce_checkout_shipping_options', 10 );
  </code></pre>
  <p>Then added</p>
  <pre><code>&lt;?php do_action( 'woocommerce_checkout_shipping_option' ); ?&gt;
  </code></pre>
  <p>into form-checkout.php</p>
  <p>and updated the woocommerce/includes/class-wc-ajax.php update_order_review function to include</p>
  <pre><code>// Get order review fragment.
  ob_start();
  woocommerce_order_review();
  $woocommerce_order_review = ob_get_clean();
  
  // Get checkout payment fragment.
  ob_start();
  woocommerce_checkout_payment();
  $woocommerce_checkout_payment = ob_get_clean();
  
  // Get checkout shipping fragment.
  ob_start();
  woocommerce_checkout_shipping_options();
  $woocommerce_checkout_shipping_options = ob_get_clean();
  
  // Get messages if reload checkout is not true.
  $reload_checkout = isset( WC()-&gt;session-&gt;reload_checkout );
  if ( ! $reload_checkout ) {
      $messages = wc_print_notices( true );
  } else {
      $messages = '';
  }
  
  unset( WC()-&gt;session-&gt;refresh_totals, WC()-&gt;session-&gt;reload_checkout );
  
  wp_send_json(
      array(
          'result'    =&gt; empty( $messages ) ? 'success' : 'failure',
          'messages'  =&gt; $messages,
          'reload'    =&gt; $reload_checkout,
          'fragments' =&gt; apply_filters(
              'woocommerce_update_order_review_fragments',
              array(
                  '.woocommerce-checkout-review-order-table' =&gt; $woocommerce_order_review,
                  '.woocommerce-checkout-payment' =&gt; $woocommerce_checkout_payment,
                  '.woocommerce-checkout-shipping-table' =&gt; $woocommerce_checkout_shipping_options,
              )
          ),
      )
  );
  </code></pre>
  <p>All I need to work out now is how to update the update_order_review ajax without editing the core files.</p>