Woocommerce 3.1.0 Compatability

This commit is contained in:
Jason King 2017-06-29 22:09:46 +09:30 committed by GitHub
parent a43eabee36
commit 870e184c7b
1 changed files with 70 additions and 66 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Cart Page * Cart Page
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability. *
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart.php. * This template can be overridden by copying it to yourtheme/woocommerce/cart/cart.php.
* *
* HOWEVER, on occasion WooCommerce will need to update template files and you * HOWEVER, on occasion WooCommerce will need to update template files and you
@ -13,11 +13,11 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.0.3 * @version 3.1.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit;
} }
wc_print_notices(); wc_print_notices();
@ -75,12 +75,12 @@ do_action( 'woocommerce_before_cart' ); ?>
?> ?>
</td> </td>
<td class="product-name" data-title="<?php _e( 'Product', 'understrap' ); ?>"> <td class="product-name" data-title="<?php esc_attr_e( 'Product', 'understrap' ); ?>">
<?php <?php
if ( ! $product_permalink ) { if ( ! $product_permalink ) {
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . '&nbsp;'; echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . '&nbsp;';
} else { } else {
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_title() ), $cart_item, $cart_item_key ); echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key );
} }
// Meta data // Meta data
@ -88,18 +88,18 @@ do_action( 'woocommerce_before_cart' ); ?>
// Backorder notification // Backorder notification
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) { if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'understrap' ) . '</p>'; echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>';
} }
?> ?>
</td> </td>
<td class="product-price" data-title="<?php _e( 'Price', 'understrap' ); ?>"> <td class="product-price" data-title="<?php esc_attr_e( 'Price', 'understrap' ); ?>">
<?php <?php
echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
?> ?>
</td> </td>
<td class="product-quantity" data-title="<?php _e( 'Quantity', 'understrap' ); ?>"> <td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'understrap' ); ?>">
<?php <?php
if ( $_product->is_sold_individually() ) { if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key ); $product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
@ -107,8 +107,8 @@ do_action( 'woocommerce_before_cart' ); ?>
$product_quantity = woocommerce_quantity_input( array( $product_quantity = woocommerce_quantity_input( array(
'input_name' => "cart[{$cart_item_key}][qty]", 'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'], 'input_value' => $cart_item['quantity'],
'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), 'max_value' => $_product->get_max_purchase_quantity(),
'min_value' => '0' 'min_value' => '0',
), $_product, false ); ), $_product, false );
} }
@ -149,16 +149,20 @@ do_action( 'woocommerce_before_cart' ); ?>
<?php do_action( 'woocommerce_after_cart_contents' ); ?> <?php do_action( 'woocommerce_after_cart_contents' ); ?>
</tbody> </tbody>
</table> </table>
<?php do_action( 'woocommerce_after_cart_table' ); ?>
<?php do_action( 'woocommerce_after_cart_table' ); ?>
</form> </form>
<div class="cart-collaterals"> <div class="cart-collaterals">
<?php
<?php do_action( 'woocommerce_cart_collaterals' ); ?> /**
* woocommerce_cart_collaterals hook.
*
* @hooked woocommerce_cross_sell_display
* @hooked woocommerce_cart_totals - 10
*/
do_action( 'woocommerce_cart_collaterals' );
?>
</div> </div>
<?php do_action( 'woocommerce_after_cart' ); ?> <?php do_action( 'woocommerce_after_cart' ); ?>