Merge pull request #700 from ZacharyElkins/WooCommerce_3.4.0

Woo commerce 3.4.0 - Thx @ZacharyElkins !
This commit is contained in:
Holger 2018-07-02 10:56:50 +02:00 committed by GitHub
commit 003f503adb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 166 additions and 194 deletions

View File

@ -13,7 +13,7 @@ if ( ! function_exists( 'understrap_woocommerce_support' ) ) {
*/ */
function understrap_woocommerce_support() { function understrap_woocommerce_support() {
add_theme_support( 'woocommerce' ); add_theme_support( 'woocommerce' );
// Add New Woocommerce 3.0.0 Product Gallery support // Add New Woocommerce 3.0.0 Product Gallery support
add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-zoom' );
@ -136,16 +136,3 @@ if ( ! function_exists ( 'understrap_wc_form_field_args' ) ) {
return $args; return $args;
} }
} }
/**
* Change loop add-to-cart button class to Bootstrap
*/
add_filter( 'woocommerce_loop_add_to_cart_args', 'understrap_woocommerce_add_to_cart_args', 10, 2 );
if ( ! function_exists ( 'understrap_woocommerce_add_to_cart_args' ) ) {
function understrap_woocommerce_add_to_cart_args( $args, $product ) {
$args['class'] = str_replace('button','btn btn-outline-primary', 'button');
return $args;
}
}

View File

@ -11,14 +11,11 @@
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.4.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
wc_print_notices(); wc_print_notices();
@ -64,57 +61,65 @@ do_action( 'woocommerce_before_cart' ); ?>
?> ?>
</td> </td>
<td class="product-thumbnail"><?php <td class="product-thumbnail">
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key ); $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $product_permalink ) { if ( ! $product_permalink ) {
echo $thumbnail; echo wp_kses_post( $thumbnail );
} else { } else {
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail ); printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), wp_kses_post( $thumbnail ) );
} }
?></td> ?>
</td>
<td class="product-name" data-title="<?php esc_attr_e( 'Product', 'understrap' ); ?>"><?php <td class="product-name" data-title="<?php esc_attr_e( 'Product', 'understrap' ); ?>">
<?php
if ( ! $product_permalink ) { if ( ! $product_permalink ) {
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . '&nbsp;'; echo wp_kses_post( 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_name() ), $cart_item, $cart_item_key ); echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) );
} }
do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
// Meta data. // Meta data.
echo wc_get_formatted_cart_item_data( $cart_item ); echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.
// 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 wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'understrap' ) . '</p>' ) );
} }
?></td> ?>
</td>
<td class="product-price" data-title="<?php esc_attr_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 ); // PHPCS: XSS ok.
?> ?>
</td> </td>
<td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'understrap' ); ?>"><?php <td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'understrap' ); ?>">
<?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 );
} else { } else {
$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->get_max_purchase_quantity(), 'max_value' => $_product->get_max_purchase_quantity(),
'min_value' => '0', 'min_value' => '0',
'product_name' => $_product->get_name(), 'product_name' => $_product->get_name(),
), $_product, false ); ), $_product, false );
} }
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok.
?></td> ?>
</td>
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'understrap' ); ?>"> <td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'understrap' ); ?>">
<?php <?php
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); // PHPCS: XSS ok.
?> ?>
</td> </td>
</tr> </tr>
@ -130,16 +135,16 @@ do_action( 'woocommerce_before_cart' ); ?>
<?php if ( wc_coupons_enabled() ) { ?> <?php if ( wc_coupons_enabled() ) { ?>
<div class="coupon"> <div class="coupon">
<label for="coupon_code"><?php esc_html_e( 'Coupon:', 'understrap' ); ?></label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'understrap' ); ?>" /> <input type="submit" class="btn btn-outline-primary" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'understrap' ); ?>" /> <label for="coupon_code"><?php esc_html_e( 'Coupon:', 'understrap' ); ?></label> <input type="text" name="coupon_code" class="input-text form-control" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'understrap' ); ?>" /> <button type="submit" class="btn btn-outline-primary" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'understrap' ); ?>"><?php esc_attr_e( 'Apply coupon', 'understrap' ); ?></button>
<?php do_action( 'woocommerce_cart_coupon' ); ?> <?php do_action( 'woocommerce_cart_coupon' ); ?>
</div> </div>
<?php } ?> <?php } ?>
<button type="submit" class="btn btn-outline-primary" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'understrap' ); ?>"><?php esc_html_e( 'Update cart', 'understrap' ); ?></button> <button type="submit" class="btn btn-outline-primary" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'understrap' ); ?>"><?php esc_html_e( 'Update cart', 'understrap' ); ?></button>
<?php do_action( 'woocommerce_cart_actions' ); ?> <?php do_action( 'woocommerce_cart_actions' ); ?>
<?php wp_nonce_field( 'woocommerce-cart' ); ?> <?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
</td> </td>
</tr> </tr>

View File

@ -50,11 +50,11 @@ do_action( 'woocommerce_before_mini_cart' ); ?>
esc_attr( $_product->get_sku() ) esc_attr( $_product->get_sku() )
), $cart_item_key ); ), $cart_item_key );
?> ?>
<?php if ( ! $_product->is_visible() ) : ?> <?php if ( empty( $product_permalink ) ) : ?>
<?php echo str_replace( array( 'http:', 'https:' ), '', $thumbnail ) . $product_name . '&nbsp;'; ?> <?php echo $thumbnail . $product_name . '&nbsp;'; ?>
<?php else : ?> <?php else : ?>
<a href="<?php echo esc_url( $product_permalink ); ?>"> <a href="<?php echo esc_url( $product_permalink ); ?>">
<?php echo str_replace( array( 'http:', 'https:' ), '', $thumbnail ) . $product_name . '&nbsp;'; ?> <?php echo $thumbnail . $product_name . '&nbsp;'; ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
<?php echo wc_get_formatted_cart_item_data( $cart_item ); ?> <?php echo wc_get_formatted_cart_item_data( $cart_item ); ?>

View File

@ -10,27 +10,25 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.4.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit; // Exit if accessed directly.
}
if ( ! wc_coupons_enabled() ) { if ( ! wc_coupons_enabled() || ! empty( WC()->cart->applied_coupons ) ) { // @codingStandardsIgnoreLine.
return; return;
} }
if ( empty( WC()->cart->applied_coupons ) ) {
$info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'understrap' ) . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'understrap' ) . '</a>' );
wc_print_notice( $info_message, 'notice' );
}
?> ?>
<div class="woocommerce-form-coupon-toggle">
<?php wc_print_notice( apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'understrap' ) . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'understrap' ) . '</a>' ), 'notice' ); ?>
</div>
<form class="checkout_coupon" method="post" style="display:none"> <form class="checkout_coupon woocommerce-form-coupon" method="post" style="display:none">
<p><?php esc_html_e( 'If you have a coupon code, please apply it below.', 'understrap' ); ?></p>
<p class="form-row form-row-first"> <p class="form-row form-row-first">
<input type="text" name="coupon_code" class="form-control" placeholder="<?php esc_attr_e( 'Coupon code', 'understrap' ); ?>" id="coupon_code" value="" /> <input type="text" name="coupon_code" class="form-control" placeholder="<?php esc_attr_e( 'Coupon code', 'understrap' ); ?>" id="coupon_code" value="" />

View File

@ -10,16 +10,14 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @package WooCommerce/Templates
* @package WooCommerce/Templates * @version 3.4.0
* @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
$totals = $order->get_order_item_totals();
?> ?>
<form id="order_review" method="post"> <form id="order_review" method="post">
@ -58,7 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php endif; ?> <?php endif; ?>
</tbody> </tbody>
<tfoot> <tfoot>
<?php if ( $totals = $order->get_order_item_totals() ) : ?> <?php if ( $totals ) : ?>
<?php foreach ( $totals as $total ) : ?> <?php foreach ( $totals as $total ) : ?>
<tr> <tr>
<th scope="row" colspan="2"><?php echo $total['label']; ?></th><?php // @codingStandardsIgnoreLine ?> <th scope="row" colspan="2"><?php echo $total['label']; ?></th><?php // @codingStandardsIgnoreLine ?>
@ -94,7 +92,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php do_action( 'woocommerce_pay_order_after_submit' ); ?> <?php do_action( 'woocommerce_pay_order_after_submit' ); ?>
<?php wp_nonce_field( 'woocommerce-pay' ); ?> <?php wp_nonce_field( 'woocommerce-pay', 'woocommerce-pay-nonce' ); ?>
</div> </div>
</div> </div>
</form> </form>

View File

@ -10,15 +10,12 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @package WooCommerce/Templates
* @package WooCommerce/Templates * @version 3.4.0
* @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
if ( ! is_ajax() ) { if ( ! is_ajax() ) {
do_action( 'woocommerce_review_order_before_payment' ); do_action( 'woocommerce_review_order_before_payment' );
@ -52,7 +49,7 @@ if ( ! is_ajax() ) {
<?php do_action( 'woocommerce_review_order_after_submit' ); ?> <?php do_action( 'woocommerce_review_order_after_submit' ); ?>
<?php wp_nonce_field( 'woocommerce-process_checkout' ); ?> <?php wp_nonce_field( 'woocommerce-process_checkout', 'woocommerce-process-checkout-nonce' ); ?>
</div> </div>
</div> </div>
<?php <?php

View File

@ -32,12 +32,12 @@ if ( is_user_logged_in() ) {
<?php echo ( $message ) ? wpautop( wptexturize( $message ) ) : ''; // @codingStandardsIgnoreLine ?> <?php echo ( $message ) ? wpautop( wptexturize( $message ) ) : ''; // @codingStandardsIgnoreLine ?>
<p class="form-row form-row-first"> <p class="form-row form-row-first">
<label for="username"><?php esc_html_e( 'Username or email', 'understrap' ); ?> <span class="required">*</span></label> <label for="username"><?php esc_html_e( 'Username or email', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="text" class="input-text form-control" name="username" id="username" /> <input type="text" class="input-text form-control" name="username" id="username" autocomplete="username" />
</p> </p>
<p class="form-row form-row-last"> <p class="form-row form-row-last">
<label for="password"><?php esc_html_e( 'Password', 'understrap' ); ?> <span class="required">*</span></label> <label for="password"><?php esc_html_e( 'Password', 'understrap' ); ?>&nbsp<span class="required">*</span></label>
<input class="input-text form-control" type="password" name="password" id="password" /> <input class="input-text form-control" type="password" name="password" id="password" autocomplete="current-password" />
</p> </p>
<div class="clear"></div> <div class="clear"></div>

View File

@ -10,15 +10,12 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @package WooCommerce/Templates
* @package WooCommerce/Templates * @version 3.4.0
* @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
if ( $max_value && $min_value === $max_value ) { if ( $max_value && $min_value === $max_value ) {
?> ?>
@ -27,10 +24,25 @@ if ( $max_value && $min_value === $max_value ) {
</div> </div>
<?php <?php
} else { } else {
/* translators: %s: Quantity. */
$labelledby = ! empty( $args['product_name'] ) ? sprintf( __( '%s quantity', 'woocommerce' ), strip_tags( $args['product_name'] ) ) : '';
?> ?>
<div class="quantity"> <div class="quantity">
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php esc_html_e( 'Quantity', 'understrap' ); ?></label> <label class="sr-only" for="<?php echo esc_attr( $input_id ); ?>"><?php esc_html_e( 'Quantity', 'understrap' ); ?></label>
<input type="number" id="<?php echo esc_attr( $input_id ); ?>" class="input-text qty text" step="<?php echo esc_attr( $step ); ?>" min="<?php echo esc_attr( $min_value ); ?>" max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $input_value ); ?>" title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'understrap' ) ?>" size="4" pattern="<?php echo esc_attr( $pattern ); ?>" inputmode="<?php echo esc_attr( $inputmode ); ?>" aria-labelledby="<?php echo ! empty( $args['product_name'] ) ? sprintf( esc_attr__( '%s quantity', 'understrap' ), $args['product_name'] ) : ''; ?>" /> <input
type="number"
id="<?php echo esc_attr( $input_id ); ?>"
class="input-text qty text"
step="<?php echo esc_attr( $step ); ?>"
min="<?php echo esc_attr( $min_value ); ?>"
max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>"
name="<?php echo esc_attr( $input_name ); ?>"
value="<?php echo esc_attr( $input_value ); ?>"
title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'understrap' ); ?>"
size="4"
pattern="<?php echo esc_attr( $pattern ); ?>"
inputmode="<?php echo esc_attr( $inputmode ); ?>"
aria-labelledby="<?php echo esc_attr( $labelledby ); ?>" />
</div> </div>
<?php <?php
} }

View File

@ -10,15 +10,12 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.4.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
do_action( 'woocommerce_before_edit_account_form' ); ?> do_action( 'woocommerce_before_edit_account_form' ); ?>
@ -27,18 +24,24 @@ do_action( 'woocommerce_before_edit_account_form' ); ?>
<?php do_action( 'woocommerce_edit_account_form_start' ); ?> <?php do_action( 'woocommerce_edit_account_form_start' ); ?>
<p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first"> <p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first">
<label for="account_first_name"><?php esc_html_e( 'First name', 'understrap' ); ?> <span class="required">*</span></label> <label for="account_first_name"><?php esc_html_e( 'First name', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="account_first_name" id="account_first_name" value="<?php echo esc_attr( $user->first_name ); ?>" /> <input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="account_first_name" id="account_first_name" autocomplete="given-name" value="<?php echo esc_attr( $user->first_name ); ?>" />
</p> </p>
<p class="woocommerce-form-row woocommerce-form-row--last form-row form-row-last"> <p class="woocommerce-form-row woocommerce-form-row--last form-row form-row-last">
<label for="account_last_name"><?php esc_html_e( 'Last name', 'understrap' ); ?> <span class="required">*</span></label> <label for="account_last_name"><?php esc_html_e( 'Last name', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="account_last_name" id="account_last_name" value="<?php echo esc_attr( $user->last_name ); ?>" /> <input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="account_last_name" id="account_last_name" autocomplete="family-name" value="<?php echo esc_attr( $user->last_name ); ?>" />
</p> </p>
<div class="clear"></div> <div class="clear"></div>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="account_email"><?php esc_html_e( 'Email address', 'understrap' ); ?> <span class="required">*</span></label> <label for="account_display_name"><?php esc_html_e( 'Display name', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="email" class="woocommerce-Input woocommerce-Input--email input-text form-control" name="account_email" id="account_email" value="<?php echo esc_attr( $user->user_email ); ?>" /> <input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="account_display_name" id="account_display_name" value="<?php echo esc_attr( $user->display_name ); ?>" /> <span><em><?php esc_html_e( 'This will be how your name will be displayed in the account section and in reviews', 'understrap' ); ?></em></span>
</p>
<div class="clear"></div>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="account_email"><?php esc_html_e( 'Email address', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="email" class="woocommerce-Input woocommerce-Input--email input-text form-control" name="account_email" id="account_email" autocomplete="email" value="<?php echo esc_attr( $user->user_email ); ?>" />
</p> </p>
<fieldset> <fieldset>
@ -46,15 +49,15 @@ do_action( 'woocommerce_before_edit_account_form' ); ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="password_current"><?php esc_html_e( 'Current password (leave blank to leave unchanged)', 'understrap' ); ?></label> <label for="password_current"><?php esc_html_e( 'Current password (leave blank to leave unchanged)', 'understrap' ); ?></label>
<input type="password" class="woocommerce-Input woocommerce-Input--password input-text form-control" name="password_current" id="password_current" /> <input type="password" class="woocommerce-Input woocommerce-Input--password input-text form-control" name="password_current" id="password_current" autocomplete="off" />
</p> </p>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="password_1"><?php esc_html_e( 'New password (leave blank to leave unchanged)', 'understrap' ); ?></label> <label for="password_1"><?php esc_html_e( 'New password (leave blank to leave unchanged)', 'understrap' ); ?></label>
<input type="password" class="woocommerce-Input woocommerce-Input--password input-text form-control" name="password_1" id="password_1" /> <input type="password" class="woocommerce-Input woocommerce-Input--password input-text form-control" name="password_1" id="password_1" autocomplete="off" />
</p> </p>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="password_2"><?php esc_html_e( 'Confirm new password', 'understrap' ); ?></label> <label for="password_2"><?php esc_html_e( 'Confirm new password', 'understrap' ); ?></label>
<input type="password" class="woocommerce-Input woocommerce-Input--password input-text form-control" name="password_2" id="password_2" /> <input type="password" class="woocommerce-Input woocommerce-Input--password input-text form-control" name="password_2" id="password_2" autocomplete="off" />
</p> </p>
</fieldset> </fieldset>
<div class="clear"></div> <div class="clear"></div>
@ -62,7 +65,7 @@ do_action( 'woocommerce_before_edit_account_form' ); ?>
<?php do_action( 'woocommerce_edit_account_form' ); ?> <?php do_action( 'woocommerce_edit_account_form' ); ?>
<p> <p>
<?php wp_nonce_field( 'save_account_details' ); ?> <?php wp_nonce_field( 'save_account_details', 'save-account-details-nonce' ); ?>
<button type="submit" class="btn btn-outline-primary" name="save_account_details" value="<?php esc_attr_e( 'Save changes', 'understrap' ); ?>"><?php esc_html_e( 'Save changes', 'understrap' ); ?></button> <button type="submit" class="btn btn-outline-primary" name="save_account_details" value="<?php esc_attr_e( 'Save changes', 'understrap' ); ?>"><?php esc_html_e( 'Save changes', 'understrap' ); ?></button>
<input type="hidden" name="action" value="save_account_details" /> <input type="hidden" name="action" value="save_account_details" />
</p> </p>

View File

@ -10,15 +10,12 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.4.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
$page_title = ( 'billing' === $load_address ) ? __( 'Billing address', 'understrap' ) : __( 'Shipping address', 'understrap' ); $page_title = ( 'billing' === $load_address ) ? __( 'Billing address', 'understrap' ) : __( 'Shipping address', 'understrap' );
@ -50,7 +47,7 @@ do_action( 'woocommerce_before_edit_account_address_form' ); ?>
<p> <p>
<button type="submit" class="btn btn-outline-primary" name="save_address" value="<?php esc_attr_e( 'Save address', 'understrap' ); ?>"><?php esc_html_e( 'Save address', 'understrap' ); ?></button> <button type="submit" class="btn btn-outline-primary" name="save_address" value="<?php esc_attr_e( 'Save address', 'understrap' ); ?>"><?php esc_html_e( 'Save address', 'understrap' ); ?></button>
<?php wp_nonce_field( 'woocommerce-edit_address' ); ?> <?php wp_nonce_field( 'woocommerce-edit_address', 'woocommerce-edit-address-nonce' ); ?>
<input type="hidden" name="action" value="edit_address" /> <input type="hidden" name="action" value="edit_address" />
</p> </p>
</div> </div>

View File

@ -11,9 +11,8 @@
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.4.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -41,11 +40,11 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php do_action( 'woocommerce_login_form_start' ); ?> <?php do_action( 'woocommerce_login_form_start' ); ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="username"><?php esc_html_e( 'Username or email address', 'understrap' ); ?> <span class="required">*</span></label> <label for="username"><?php esc_html_e( 'Username or email address', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="username" id="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?> <input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="username" id="username" autocomplete="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</p> </p>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="password"><?php esc_html_e( 'Password', 'understrap' ); ?> <span class="required">*</span></label> <label for="password"><?php esc_html_e( 'Password', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input class="woocommerce-Input woocommerce-Input--text input-text form-control" type="password" name="password" id="password" /> <input class="woocommerce-Input woocommerce-Input--text input-text form-control" type="password" name="password" id="password" />
</p> </p>
@ -53,7 +52,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<p class="form-row"> <p class="form-row">
<?php wp_nonce_field( 'woocommerce-login', 'woocommerce-login-nonce' ); ?> <?php wp_nonce_field( 'woocommerce-login', 'woocommerce-login-nonce' ); ?>
<button type="submit" class="btn btn-outline-primary" name="login" value="<?php esc_attr_e( 'Login', 'understrap' ); ?>"><?php esc_html_e( 'Login', 'understrap' ); ?></button> <button type="submit" class="btn btn-outline-primary" name="login" value="<?php esc_attr_e( 'Log in', 'understrap' ); ?>"><?php esc_html_e( 'Login', 'understrap' ); ?></button>
<label class="woocommerce-form__label woocommerce-form__label-for-checkbox inline"> <label class="woocommerce-form__label woocommerce-form__label-for-checkbox inline">
<input class="woocommerce-form__input woocommerce-form__input-checkbox" name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span><?php esc_html_e( 'Remember me', 'understrap' ); ?></span> <input class="woocommerce-form__input woocommerce-form__input-checkbox" name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span><?php esc_html_e( 'Remember me', 'understrap' ); ?></span>
</label> </label>
@ -74,29 +73,29 @@ if ( ! defined( 'ABSPATH' ) ) {
<h2><?php esc_html_e( 'Register', 'understrap' ); ?></h2> <h2><?php esc_html_e( 'Register', 'understrap' ); ?></h2>
<form method="post" class="register"> <form method="post" class="woocommerce-form woocommerce-form-register register">
<?php do_action( 'woocommerce_register_form_start' ); ?> <?php do_action( 'woocommerce_register_form_start' ); ?>
<?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?> <?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="reg_username"><?php esc_html_e( 'Username', 'understrap' ); ?> <span class="required">*</span></label> <label for="reg_username"><?php esc_html_e( 'Username', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="username" id="reg_username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( $_POST['username'] ) : ''; ?>" /> <input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="username" id="reg_username" autocomplete="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="reg_email"><?php esc_html_e( 'Email address', 'understrap' ); ?> <span class="required">*</span></label> <label for="reg_email"><?php esc_html_e( 'Email address', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="email" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="email" id="reg_email" value="<?php echo ( ! empty( $_POST['email'] ) ) ? esc_attr( $_POST['email'] ) : ''; ?>" /> <input type="email" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="email" id="reg_email" autocomplete="email" value="<?php echo ( ! empty( $_POST['email'] ) ) ? esc_attr( wp_unslash( $_POST['email'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</p> </p>
<?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?> <?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="reg_password"><?php esc_html_e( 'Password', 'understrap' ); ?> <span class="required">*</span></label> <label for="reg_password"><?php esc_html_e( 'Password', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password" id="reg_password" /> <input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password" id="reg_password" autocomplete="new-password" />
</p> </p>
<?php endif; ?> <?php endif; ?>

View File

@ -10,15 +10,12 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.4.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
wc_print_notices(); ?> wc_print_notices(); ?>
@ -28,7 +25,7 @@ wc_print_notices(); ?>
<p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first"> <p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first">
<label for="user_login"><?php esc_html_e( 'Username or email', 'understrap' ); ?></label> <label for="user_login"><?php esc_html_e( 'Username or email', 'understrap' ); ?></label>
<input class="woocommerce-Input woocommerce-Input--text input-text form-control" type="text" name="user_login" id="user_login" /> <input class="woocommerce-Input woocommerce-Input--text input-text form-control" type="text" name="user_login" id="user_login" autocomplete="username" />
</p> </p>
<div class="clear"></div> <div class="clear"></div>
@ -40,6 +37,6 @@ wc_print_notices(); ?>
<button type="submit" class="btn btn-outline-primary" value="<?php esc_attr_e( 'Reset password', 'understrap' ); ?>"><?php esc_html_e( 'Reset password', 'understrap' ); ?></button> <button type="submit" class="btn btn-outline-primary" value="<?php esc_attr_e( 'Reset password', 'understrap' ); ?>"><?php esc_html_e( 'Reset password', 'understrap' ); ?></button>
</p> </p>
<?php wp_nonce_field( 'lost_password' ); ?> <?php wp_nonce_field( 'lost_password', 'woocommerce-lost-password-nonce' ); ?>
</form> </form>

View File

@ -10,15 +10,12 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.4.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
wc_print_notices(); ?> wc_print_notices(); ?>
@ -27,12 +24,12 @@ wc_print_notices(); ?>
<p><?php echo apply_filters( 'woocommerce_reset_password_message', esc_html__( 'Enter a new password below.', 'understrap') ); ?></p><?php // @codingStandardsIgnoreLine ?> <p><?php echo apply_filters( 'woocommerce_reset_password_message', esc_html__( 'Enter a new password below.', 'understrap') ); ?></p><?php // @codingStandardsIgnoreLine ?>
<p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first"> <p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first">
<label for="password_1"><?php esc_html_e( 'New password', 'understrap' ); ?> <span class="required">*</span></label> <label for="password_1"><?php esc_html_e( 'New password', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password_1" id="password_1" /> <input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password_1" id="password_1" autocomplete="new-password" />
</p> </p>
<p class="woocommerce-form-row woocommerce-form-row--last form-row form-row-last"> <p class="woocommerce-form-row woocommerce-form-row--last form-row form-row-last">
<label for="password_2"><?php esc_html_e( 'Re-enter new password', 'understrap' ); ?> <span class="required">*</span></label> <label for="password_2"><?php esc_html_e( 'Re-enter new password', 'understrap' ); ?>&nbsp;<span class="required">*</span></label>
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password_2" id="password_2" /> <input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password_2" id="password_2" autocomplete="new-password" />
</p> </p>
<input type="hidden" name="reset_key" value="<?php echo esc_attr( $args['key'] ); ?>" /> <input type="hidden" name="reset_key" value="<?php echo esc_attr( $args['key'] ); ?>" />
@ -47,6 +44,6 @@ wc_print_notices(); ?>
<button type="submit" class="btn btn-outline-primary" value="<?php esc_attr_e( 'Save', 'understrap' ); ?>"><?php esc_html_e( 'Save', 'understrap' ); ?></button> <button type="submit" class="btn btn-outline-primary" value="<?php esc_attr_e( 'Save', 'understrap' ); ?>"><?php esc_html_e( 'Save', 'understrap' ); ?></button>
</p> </p>
<?php wp_nonce_field( 'reset_password' ); ?> <?php wp_nonce_field( 'reset_password', 'woocommerce-reset-password-nonce' ); ?>
</form> </form>

View File

@ -10,14 +10,12 @@
* happen. When this occurs the version of the template file will be bumped and * happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @package WooCommerce/Templates
* @package WooCommerce/Templates * @version 3.4.0
* @version 3.0.0
*/ */
if ( ! defined( 'ABSPATH' ) ) {
exit; defined( 'ABSPATH' ) || exit;
}
global $product; global $product;
@ -25,44 +23,30 @@ if ( ! $product->is_purchasable() ) {
return; return;
} }
echo wc_get_stock_html( $product ); echo wc_get_stock_html( $product ); // WPCS: XSS ok.
if ( $product->is_in_stock() ) : ?> if ( $product->is_in_stock() ) : ?>
<?php do_action( 'woocommerce_before_add_to_cart_form' ); ?> <?php do_action( 'woocommerce_before_add_to_cart_form' ); ?>
<form class="cart" action="<?php echo esc_url( get_permalink() ); ?>" method="post" enctype='multipart/form-data'> <form class="cart" action="<?php echo esc_url( apply_filters( 'woocommerce_add_to_cart_form_action', $product->get_permalink() ) ); ?>" method="post" enctype='multipart/form-data'>
<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
<?php <?php
/** do_action( 'woocommerce_before_add_to_cart_quantity' );
* @since 2.1.0.
*/
do_action( 'woocommerce_before_add_to_cart_button' );
/** woocommerce_quantity_input( array(
* @since 3.0.0. 'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
*/ 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
do_action( 'woocommerce_before_add_to_cart_quantity' ); 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( wp_unslash( $_POST['quantity'] ) ) : $product->get_min_purchase_quantity(), // WPCS: CSRF ok, input var ok.
) );
woocommerce_quantity_input( array( do_action( 'woocommerce_after_add_to_cart_quantity' );
'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : $product->get_min_purchase_quantity(),
) );
/**
* @since 3.0.0.
*/
do_action( 'woocommerce_after_add_to_cart_quantity' );
?> ?>
<button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="btn btn-outline-primary"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button> <button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="btn btn-outline-primary"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
<?php <?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
/**
* @since 2.1.0.
*/
do_action( 'woocommerce_after_add_to_cart_button' );
?>
</form> </form>
<?php do_action( 'woocommerce_after_add_to_cart_form' ); ?> <?php do_action( 'woocommerce_after_add_to_cart_form' ); ?>

View File

@ -2,36 +2,34 @@
/** /**
* Single variation cart button * Single variation cart button
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.0.0 * @version 3.4.0
*/ */
if ( ! defined( 'ABSPATH' ) ) {
exit; defined( 'ABSPATH' ) || exit;
}
global $product; global $product;
?> ?>
<div class="woocommerce-variation-add-to-cart variations_button"> <div class="woocommerce-variation-add-to-cart variations_button">
<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
<?php <?php
/** do_action( 'woocommerce_before_add_to_cart_quantity' );
* @since 3.0.0.
*/
do_action( 'woocommerce_before_add_to_cart_quantity' );
woocommerce_quantity_input( array( woocommerce_quantity_input( array(
'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ), 'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ), 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : $product->get_min_purchase_quantity(), 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( wp_unslash( $_POST['quantity'] ) ) : $product->get_min_purchase_quantity(), // WPCS: CSRF ok, input var ok.
) ); ) );
/** do_action( 'woocommerce_after_add_to_cart_quantity' );
* @since 3.0.0.
*/
do_action( 'woocommerce_after_add_to_cart_quantity' );
?> ?>
<button type="submit" class="single_add_to_cart_button btn btn-primary"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button> <button type="submit" class="single_add_to_cart_button btn btn-primary"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
<?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
<input type="hidden" name="add-to-cart" value="<?php echo absint( $product->get_id() ); ?>" /> <input type="hidden" name="add-to-cart" value="<?php echo absint( $product->get_id() ); ?>" />
<input type="hidden" name="product_id" value="<?php echo absint( $product->get_id() ); ?>" /> <input type="hidden" name="product_id" value="<?php echo absint( $product->get_id() ); ?>" />
<input type="hidden" name="variation_id" class="variation_id" value="0" /> <input type="hidden" name="variation_id" class="variation_id" value="0" />