• Resolved alexiusgrey

    (@alexiusgrey)


    I’ve made my own view of myaccount/orders page, without the table, using wc_get_orders loop. My client needs the ‘return request’ button.
    How can I show it? Is there a code or shortcode to place it in my loop?
    Cause I check the all order statuses, exluding refunded/returned, check checkboxes, etc, and don’t see the button. I think because my code is custom. What’s the code of your button?
    My code of the page is

    
    
    <h2 class="text-center woocommerce-products-header__title page-title need-title"><?php echo get_theme_mod('my_orders_tab_heading') ?></h2>
    <section class="order">
    <?php 
    $orders = wc_get_orders( array(
      'numberposts' => -1,  
       'orderby' => 'date',
       'order' => 'DESC',  
       'customer_id' => get_current_user_id(),
    ) );
    
    //* Loop through each WC_Order object
    foreach( $orders as $order ){?>
        <div class="order-wrapper product d-flex col-12">
            <?php 
            $order_data = $order->get_data(); // The Order data
            $order_id = $order_data['id'];
            $order_currency = $order_data['currency'];
            $order_status = $order_data['status'];        
             ?>
            <div class="order-number">#<?php echo  $order_id;?></div>         
            <div class="order-inner">
                <div class="order-inner-top">
                    <?php    
                    foreach ($order->get_items() as $key => $lineItem) {
                    $product_id = $lineItem['product_id'];
                    $product = wc_get_product( $product_id );
                   
                    $item_meta_data = $lineItem->get_meta_data();
                    $colormeta = $lineItem->get_meta( 'pa_color', true );
                    $sizemeta = $lineItem->get_meta( 'pa_size', true ); ?>
                    <div class="order-inner-top-inner">
                        <div class="order-slider-inner"> 
                            <div class="order-inner-left">
                                <div class="order-image">
                                    <?php echo $product->get_image(['322', '304']);?>                                    
                                </div>
                            </div>
                            <div class="order-inner-right">
                                <div class="order-info-item order-info-item-name">
                                    <?php echo $lineItem['name'] ?>
                               </div>
                               <div class="order-info-item order-info-item ">
                                    <span class="order-price"><?php echo $lineItem['total'] . $order_currency?></span>
                               </div>
                               <div class="order-item-quantity"><?php esc_html_e( 'Quantity', 'woocommerce' )?>: <?php echo $lineItem['qty']?></div>
                                <div class="order-item-metas"><?php echo $colormeta . ' , ' . $sizemeta ?></div>
                            </div>
                        </div>
                    </div>
                    <?php }  ?>          
                </div>          
              
              <div class="order-inner-bottom">
                   <div class="d-flex justify-content-center">
                        <button class="order-total"><?php echo get_theme_mod('orders_total_button');?></button> 
                  </div>
                  <div class="totals-toggle">
                      <div class="order-info-item bottom"> <span> <?php esc_html_e( 'Price', 'woocommerce' )?>:</span><span class="order-total-price"> <?php echo $order->get_total() . '  ' . $order_currency; ?></span></div>       
                      <div class="order-info-item bottom"> <span> <?php esc_html_e( 'Quantity', 'woocommerce' )?>:</span> <?php echo  $order->get_item_count(); ?></div>         
                      <div class="order-info-item bottom"> <span><?php esc_html_e( 'Status', 'woocommerce' )?>:</span> <?php
    
                      if( 'processing'== $order->get_status() ) {
                         echo _x( 'Processing', 'Order status', 'woocommerce' );                     
                        }
                      if( 'pending'== $order->get_status() ) {
                         echo _x( 'Pending payment', 'Order status', 'woocommerce' );                     
                      }                    
                      if( 'completed'== $order->get_status() ) {
                         echo _x( 'Completed', 'Order status', 'woocommerce' );                     
                        }
                       if( 'cancelled'== $order->get_status() ) {
                         echo _x( 'Cancelled', 'Order status', 'woocommerce' );                     
                      }                    
                      if( 'refunded'== $order->get_status() ) {
                         echo _x( 'Refunded', 'Order status', 'woocommerce' );                     
                        }
                           if( 'failed'== $order->get_status() ) {
                         echo _x( 'Failed', 'Order status', 'woocommerce' );                     
                      }                    
                      if( 'on-hold'== $order->get_status() ) {
                         echo _x( 'On hold', 'Order status', 'woocommerce' );                     
                        }        
    
                       ?></div>
                      <div class="order-info-item bottom"> <span><?php esc_html_e( 'Order Date', 'woocommerce' )?></span> <?php 
                        if( $date_created = $order->get_date_created() ){
                            // Display the localized formatted date
                             $formated_date_created = $date_created->date_i18n('j F, Y ');
                             echo  $formated_date_created;
                        }                   
    
                       ?></div>
                       <div class="order-info-item bottom"> <span><?php echo get_theme_mod('delivery_date_text')?>: </span> 
                       <?php 
                            // The orders date
                             $date_created = $order->get_date_created();
                             $date_created =  $date_created->date('j F, Y');
                            // The order date + 5 days
                            $delivery_date = date_i18n( 'j F, Y', strtotime( $date_created . ' +21 days' ));                       
                            echo $delivery_date;
                        ?>
                         </div>
                    </div>
              </div> 
    
            </div>
           
     </div> 
      <?php cosmetic_standart_pagination(); ?>
    <?php  }?>
    
    </section>

    `
    It has to look like that

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • MakeWebBetter

    (@makewebbetter)

    Hello,

    Thank you for trying our plugin,

    As per your query let me tell you that we currently show button on the order, view order details, and on thank you page,

    Regards,

Viewing 1 replies (of 1 total)
  • The topic ‘How to show request button on my custom orders page?’ is closed to new replies.