Advertisement
Guest User

review-order.php

a guest
Nov 22nd, 2016
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.62 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Review order table
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/checkout/review-order.php.
  6.  *
  7.  * HOWEVER, on occasion WooCommerce will need to update template files and you
  8.  * (the theme developer) will need to copy the new files to your theme to
  9.  * maintain compatibility. We try to do this as little as possible, but it does
  10.  * happen. When this occurs the version of the template file will be bumped and
  11.  * the readme will list any important changes.
  12.  *
  13.  * @see         https://docs.woocommerce.com/document/template-structure/
  14.  * @author      WooThemes
  15.  * @package     WooCommerce/Templates
  16.  * @version     2.3.0
  17.  */
  18.  
  19. if ( ! defined( 'ABSPATH' ) ) {
  20.     exit;
  21. }
  22. ?>
  23. <table class="shop_table woocommerce-checkout-review-order-table">
  24.     <thead>
  25.         <tr>
  26.             <th class="product-name"><?php _e( 'Image', 'woocommerce' ); ?></th>
  27.             <th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
  28.             <th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th>
  29.         </tr>
  30.     </thead>
  31.     <tbody>
  32.         <?php
  33.             do_action( 'woocommerce_review_order_before_cart_contents' );
  34.  
  35.  
  36.  
  37.             foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
  38.                 $_product     = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
  39.                 if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
  40.                     ?>
  41.                     <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
  42.                         <td class="product-thumb">
  43.                             <?php $thumb = get_the_post_thumbnail_url($_product->id, 'shop_catalog'); ?>
  44.                             <?php
  45.                                 if(!empty($thumb)) {
  46.                                     echo "<img src='{$thumb}' width='80px' height='100px'/>";
  47.                                 }
  48.                             ?>
  49.                         </td>
  50.                         <td class="product-name">
  51.                             <?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . '&nbsp;'; ?>
  52.                             <?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( '&times; %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); ?>
  53.                             <?php echo WC()->cart->get_item_data( $cart_item ); ?>
  54.                         </td>
  55.                         <td class="product-total">
  56.                             <?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
  57.                         </td>
  58.                     </tr>
  59.                     <?php
  60.                 }
  61.             }
  62.  
  63.             do_action( 'woocommerce_review_order_after_cart_contents' );
  64.         ?>
  65.     </tbody>
  66.     <tfoot>
  67.  
  68.         <tr class="cart-subtotal">
  69.             <th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
  70.             <td><?php wc_cart_totals_subtotal_html(); ?></td>
  71.         </tr>
  72.  
  73.         <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
  74.             <tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
  75.                 <th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
  76.                 <td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
  77.             </tr>
  78.         <?php endforeach; ?>
  79.  
  80.         <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
  81.  
  82.             <?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
  83.  
  84.             <?php wc_cart_totals_shipping_html(); ?>
  85.  
  86.             <?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
  87.  
  88.         <?php endif; ?>
  89.  
  90.         <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
  91.             <tr class="fee">
  92.                 <th><?php echo esc_html( $fee->name ); ?></th>
  93.                 <td><?php wc_cart_totals_fee_html( $fee ); ?></td>
  94.             </tr>
  95.         <?php endforeach; ?>
  96.  
  97.         <?php if ( wc_tax_enabled() && 'excl' === WC()->cart->tax_display_cart ) : ?>
  98.             <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
  99.                 <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
  100.                     <tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
  101.                         <th><?php echo esc_html( $tax->label ); ?></th>
  102.                         <td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
  103.                     </tr>
  104.                 <?php endforeach; ?>
  105.             <?php else : ?>
  106.                 <tr class="tax-total">
  107.                     <th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
  108.                     <td><?php wc_cart_totals_taxes_total_html(); ?></td>
  109.                 </tr>
  110.             <?php endif; ?>
  111.         <?php endif; ?>
  112.  
  113.         <?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
  114.  
  115.         <tr class="order-total">
  116.             <th><?php _e( 'Total', 'woocommerce' ); ?></th>
  117.             <td><?php wc_cart_totals_order_total_html(); ?></td>
  118.         </tr>
  119.  
  120.         <?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
  121.  
  122.     </tfoot>
  123. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement