generated from autonomic-cooperative/wordpress-starter
Initial theme import
This commit is contained in:
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Empty cart page
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-empty.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 7.0.1
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
?>
|
||||
<?php /*** Our code modification inside Woo template - div empty cart wrapper around code and tiny class name for button ***/ ?>
|
||||
|
||||
<div class="empty-cart-wrapper">
|
||||
|
||||
<?php do_action( 'woocommerce_cart_is_empty' ); ?>
|
||||
|
||||
<?php if ( wc_get_page_id( 'shop' ) > 0 ) : ?>
|
||||
<p class="return-to-shop">
|
||||
<a class="button wc-backward<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?> tiny" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
|
||||
<?php esc_html_e( 'Return to shop', 'bridge' ) ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Cart item data (when outputting non-flat)
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-item-data.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce\Templates
|
||||
* @version 2.4.0
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<dl class="variation">
|
||||
<?php foreach ( $item_data as $data ) : ?>
|
||||
<dt class="<?php echo sanitize_html_class( 'variation-' . $data['key'] ); ?>"><?php echo wp_kses_post( $data['key'] ); ?>:</dt>
|
||||
<dd class="<?php echo sanitize_html_class( 'variation-' . $data['key'] ); ?>"><?php echo wp_kses_post( wpautop( $data['display'] ) ); ?></dd>
|
||||
<?php endforeach; ?>
|
||||
</dl>
|
||||
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Shipping Methods Display
|
||||
*
|
||||
* In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-shipping.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce/Templates
|
||||
* @version 3.6.0
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$formatted_destination = isset( $formatted_destination ) ? $formatted_destination : WC()->countries->get_formatted_address( $package['destination'], ', ' );
|
||||
$has_calculated_shipping = ! empty( $has_calculated_shipping );
|
||||
$show_shipping_calculator = ! empty( $show_shipping_calculator );
|
||||
$calculator_text = '';
|
||||
?>
|
||||
<tr class="woocommerce-shipping-totals shipping">
|
||||
<th><?php echo wp_kses_post( $package_name ); ?></th>
|
||||
<td data-title="<?php echo esc_attr( $package_name ); ?>">
|
||||
<?php if ( $available_methods ) : ?>
|
||||
<ul id="shipping_method" class="woocommerce-shipping-methods">
|
||||
<?php foreach ( $available_methods as $method ) : ?>
|
||||
<li>
|
||||
<?php
|
||||
if ( 1 < count( $available_methods ) ) {
|
||||
printf( '<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" %4$s />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ) ); // WPCS: XSS ok.
|
||||
} else {
|
||||
printf( '<input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ) ); // WPCS: XSS ok.
|
||||
}
|
||||
printf( '<label for="shipping_method_%1$s_%2$s">%3$s</label>', $index, esc_attr( sanitize_title( $method->id ) ), wc_cart_totals_shipping_method_label( $method ) ); // WPCS: XSS ok.
|
||||
do_action( 'woocommerce_after_shipping_rate', $method, $index );
|
||||
?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php if ( is_cart() ) : ?>
|
||||
<p class="woocommerce-shipping-destination">
|
||||
<?php
|
||||
if ( $formatted_destination ) {
|
||||
// Translators: $s shipping destination.
|
||||
printf( esc_html__( 'Shipping to %s.', 'bridge' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' );
|
||||
$calculator_text = esc_html__( 'Change address', 'bridge' );
|
||||
} else {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_shipping_estimate_html', esc_html__( 'Shipping options will be updated during checkout.', 'bridge' ) ) );
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
elseif ( ! $has_calculated_shipping || ! $formatted_destination ) :
|
||||
esc_html_e( 'Enter your address to view shipping options.', 'bridge' );
|
||||
elseif ( ! is_cart() ) :
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_no_shipping_available_html', esc_html__( 'There are no shipping methods available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'bridge' ) ) );
|
||||
else :
|
||||
// Translators: $s shipping destination.
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_no_shipping_available_html', sprintf( esc_html__( 'No shipping options were found for %s.', 'bridge' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ) ) );
|
||||
$calculator_text = esc_html__( 'Enter a different address', 'bridge' );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php if ( $show_package_details ) : ?>
|
||||
<?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html( $package_details ) . '</small></p>'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php /*** Our code modification inside Woo template - removed shipping calculator functions/element ***/ ?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Cart totals
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-totals.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.3.6
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="cart_totals <?php echo ( WC()->customer->has_calculated_shipping() ) ? 'calculated_shipping' : ''; ?>">
|
||||
|
||||
<?php do_action( 'woocommerce_before_cart_totals' ); ?>
|
||||
|
||||
|
||||
<table cellspacing="0" class="shop_table shop_table_responsive">
|
||||
|
||||
<tr class="cart-subtotal">
|
||||
<th><?php esc_html_e( 'Subtotal', 'bridge' ); ?></th>
|
||||
<td data-title="<?php esc_attr_e( 'Subtotal', 'bridge' ); ?>"><?php wc_cart_totals_subtotal_html(); ?></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<?php /*** Our code modification inside Woo template - removed processed to checkout function/element ***/ ?>
|
||||
|
||||
<?php /*** commented out with maya do_action( 'woocommerce_after_cart_totals' ); ***/ ?>
|
||||
|
||||
</div>
|
||||
192
wp-content/themes/mont58-coffee/woocommerce/cart/cart.php
Normal file
192
wp-content/themes/mont58-coffee/woocommerce/cart/cart.php
Normal file
@ -0,0 +1,192 @@
|
||||
<?php
|
||||
/**
|
||||
* Cart Page
|
||||
*
|
||||
* 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
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce/Templates
|
||||
* @version 7.0.1
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
do_action( 'woocommerce_before_cart' ); ?>
|
||||
|
||||
<form class="woocommerce-cart-form" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
|
||||
<?php do_action( 'woocommerce_before_cart_table' ); ?>
|
||||
|
||||
<table class="shop_table shop_table_responsive cart woocommerce-cart-form__contents" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="product-remove"><span class="screen-reader-text"><?php esc_html_e( 'Remove item', 'bridge' ); ?></span></th>
|
||||
<th class="product-thumbnail"><span class="screen-reader-text"><?php esc_html_e( 'Thumbnail image', 'bridge' ); ?></span></th>
|
||||
<th class="product-name"><?php esc_html_e( 'Product', 'bridge' ); ?></th>
|
||||
<th class="product-price"><?php esc_html_e( 'Price', 'bridge' ); ?></th>
|
||||
<th class="product-quantity"><?php esc_html_e( 'Quantity', 'bridge' ); ?></th>
|
||||
<th class="product-subtotal"><?php esc_html_e( 'Subtotal', 'bridge' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php do_action( 'woocommerce_before_cart_contents' ); ?>
|
||||
|
||||
<?php
|
||||
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
|
||||
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
|
||||
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
|
||||
|
||||
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
|
||||
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
|
||||
?>
|
||||
<tr class="woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
|
||||
|
||||
<td class="product-remove">
|
||||
<?php
|
||||
// @codingStandardsIgnoreLine
|
||||
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
|
||||
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">×</a>',
|
||||
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
|
||||
esc_html__( 'Remove this item', 'bridge' ),
|
||||
esc_attr( $product_id ),
|
||||
esc_attr( $_product->get_sku() )
|
||||
), $cart_item_key );
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-thumbnail">
|
||||
<?php
|
||||
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
|
||||
|
||||
if ( ! $product_permalink ) {
|
||||
echo bridge_qode_get_module_part($thumbnail); // PHPCS: XSS ok.
|
||||
} else {
|
||||
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail ); // PHPCS: XSS ok.
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-name" data-title="<?php esc_attr_e( 'Product', 'bridge' ); ?>">
|
||||
<?php
|
||||
|
||||
/*** Our code modification inside Woo template - begin ***/
|
||||
|
||||
if ( version_compare( WOOCOMMERCE_VERSION, '3.0' ) >= 0 ) {
|
||||
if ( ! $product_permalink ) {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', esc_html( $_product->get_name() ), $cart_item, $cart_item_key ) . ' ' );
|
||||
} else {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), esc_html( $_product->get_name() ) ), $cart_item, $cart_item_key ) );
|
||||
}
|
||||
} else {
|
||||
if ( ! $product_permalink ) {
|
||||
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . ' ';
|
||||
} 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 );
|
||||
}
|
||||
}
|
||||
|
||||
/*** Our code modification inside Woo template - end ***/
|
||||
|
||||
// Meta data.
|
||||
echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.
|
||||
|
||||
// Backorder notification.
|
||||
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'bridge' ) . '</p>', $product_id ) );
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-price" data-title="<?php esc_attr_e( 'Price', 'bridge' ); ?>">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // PHPCS: XSS ok.
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'bridge' ); ?>">
|
||||
<?php
|
||||
if ( $_product->is_sold_individually() ) {
|
||||
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
|
||||
} else {
|
||||
$product_quantity = woocommerce_quantity_input( array(
|
||||
'input_name' => "cart[{$cart_item_key}][qty]",
|
||||
'input_value' => $cart_item['quantity'],
|
||||
'max_value' => $_product->get_max_purchase_quantity(),
|
||||
'min_value' => '0',
|
||||
'product_name' => $_product->get_name(),
|
||||
), $_product, false );
|
||||
}
|
||||
|
||||
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok.
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Subtotal', 'bridge' ); ?>">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php do_action( 'woocommerce_cart_contents' ); ?>
|
||||
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
|
||||
<td>
|
||||
<?php do_action( 'woocommerce_before_cart_collaterals' ); ?>
|
||||
|
||||
|
||||
<div class="cart-collaterals clearfix" style:"text-align:right;">
|
||||
<?php
|
||||
/**
|
||||
* woocommerce_cart_collaterals hook.
|
||||
*
|
||||
* @hooked woocommerce_cross_sell_display
|
||||
* @hooked woocommerce_cart_totals - 10
|
||||
*/
|
||||
do_action( 'woocommerce_cart_collaterals' );
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php do_action( 'woocommerce_after_cart' ); ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6" class="actions">
|
||||
|
||||
<input type="submit" class="button" name="update_cart<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>" value="<?php esc_attr_e( 'Update cart', 'bridge' ); ?>" />
|
||||
|
||||
<?php /*** Our code modification inside Woo template - begin ***/ ?>
|
||||
<?php do_action( 'woocommerce_proceed_to_checkout' ); ?>
|
||||
<?php /*** Our code modification inside Woo template - end ***/ ?>
|
||||
|
||||
<?php do_action( 'woocommerce_cart_actions' ); ?>
|
||||
|
||||
<?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php do_action( 'woocommerce_after_cart_contents' ); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php do_action( 'woocommerce_after_cart_table' ); ?>
|
||||
</form>
|
||||
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Cross-sells
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cross-sells.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce\Templates
|
||||
* @version 4.4.0
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( $cross_sells ) : ?>
|
||||
|
||||
<div class="cross-sells">
|
||||
<?php
|
||||
$heading = apply_filters( 'woocommerce_product_cross_sells_products_heading', __( 'You may be interested in…', 'woocommerce' ) );
|
||||
|
||||
if ( $heading ) :
|
||||
?>
|
||||
<h2><?php echo esc_html( $heading ); ?></h2>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php woocommerce_product_loop_start(); ?>
|
||||
|
||||
<?php foreach ( $cross_sells as $cross_sell ) : ?>
|
||||
|
||||
<?php
|
||||
$post_object = get_post( $cross_sell->get_id() );
|
||||
|
||||
setup_postdata( $GLOBALS['post'] =& $post_object ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited, Squiz.PHP.DisallowMultipleAssignments.Found
|
||||
|
||||
wc_get_template_part( 'content', 'product' );
|
||||
?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php woocommerce_product_loop_end(); ?>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* Mini-cart
|
||||
*
|
||||
* Contains the markup for the mini-cart, used by the cart widget.
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/mini-cart.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce\Templates
|
||||
* @version 5.2.0
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
do_action( 'woocommerce_before_mini_cart' ); ?>
|
||||
|
||||
<?php if ( ! WC()->cart->is_empty() ) : ?>
|
||||
|
||||
<ul class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr( $args['list_class'] ); ?>">
|
||||
<?php
|
||||
do_action( 'woocommerce_before_mini_cart_contents' );
|
||||
|
||||
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
|
||||
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
|
||||
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
|
||||
|
||||
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
|
||||
$product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key );
|
||||
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
|
||||
$product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
|
||||
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
|
||||
?>
|
||||
<li class="woocommerce-mini-cart-item <?php echo esc_attr( apply_filters( 'woocommerce_mini_cart_item_class', 'mini_cart_item', $cart_item, $cart_item_key ) ); ?>">
|
||||
<?php
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'woocommerce_cart_item_remove_link',
|
||||
sprintf(
|
||||
'<a href="%s" class="remove remove_from_cart_button" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s">×</a>',
|
||||
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
|
||||
esc_attr__( 'Remove this item', 'woocommerce' ),
|
||||
esc_attr( $product_id ),
|
||||
esc_attr( $cart_item_key ),
|
||||
esc_attr( $_product->get_sku() )
|
||||
),
|
||||
$cart_item_key
|
||||
);
|
||||
?>
|
||||
<?php if ( empty( $product_permalink ) ) : ?>
|
||||
<?php echo $thumbnail . wp_kses_post( $product_name ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo esc_url( $product_permalink ); ?>">
|
||||
<?php echo $thumbnail . wp_kses_post( $product_name ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php echo wc_get_formatted_cart_item_data( $cart_item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s × %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_mini_cart_contents' );
|
||||
?>
|
||||
</ul>
|
||||
|
||||
<p class="woocommerce-mini-cart__total total">
|
||||
<?php
|
||||
/**
|
||||
* Hook: woocommerce_widget_shopping_cart_total.
|
||||
*
|
||||
* @hooked woocommerce_widget_shopping_cart_subtotal - 10
|
||||
*/
|
||||
do_action( 'woocommerce_widget_shopping_cart_total' );
|
||||
?>
|
||||
</p>
|
||||
|
||||
<?php do_action( 'woocommerce_widget_shopping_cart_before_buttons' ); ?>
|
||||
|
||||
<p class="woocommerce-mini-cart__buttons buttons"><?php do_action( 'woocommerce_widget_shopping_cart_buttons' ); ?></p>
|
||||
|
||||
<?php do_action( 'woocommerce_widget_shopping_cart_after_buttons' ); ?>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<p class="woocommerce-mini-cart__empty-message"><?php esc_html_e( 'No products in the cart.', 'woocommerce' ); ?></p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_after_mini_cart' ); ?>
|
||||
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Proceed to checkout button
|
||||
*
|
||||
* Contains the markup for the proceed to checkout button on the cart.
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/proceed-to-checkout-button.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce\Templates
|
||||
* @version 7.0.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="<?php echo esc_url( wc_get_checkout_url() ); ?>" class="checkout-button button alt wc-forward<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>">
|
||||
<?php esc_html_e( 'Proceed to checkout', 'woocommerce' ); ?>
|
||||
</a>
|
||||
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Shipping Calculator
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/shipping-calculator.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
* maintain compatibility. We try to do this as little as possible, but it does
|
||||
* happen. When this occurs the version of the template file will be bumped and
|
||||
* the readme will list any important changes.
|
||||
*
|
||||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @package WooCommerce/Templates
|
||||
* @version 7.0.1
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
do_action( 'woocommerce_before_shipping_calculator' ); ?>
|
||||
|
||||
<form class="woocommerce-shipping-calculator shipping_calculator" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
|
||||
|
||||
<?php /*** Our code modification inside Woo template - begin ***/ ?>
|
||||
<h2><a href="#" class="shipping-calculator-button"><?php ! empty( $button_text ) ? esc_attr($button_text) : esc_html_e( 'Calculate shipping', 'bridge' ) ; ?><span>↓</span></a></h2>
|
||||
<?php /*** Our code modification inside Woo template - end ***/ ?>
|
||||
|
||||
<section class="shipping-calculator-form" style="display:none;">
|
||||
|
||||
<?php if ( apply_filters( 'woocommerce_shipping_calculator_enable_country', true ) ) : ?>
|
||||
<p class="form-row form-row-wide" id="calc_shipping_country_field">
|
||||
<label for="calc_shipping_country" class="screen-reader-text"><?php esc_html_e( 'Country / region:', 'bridge' ); ?></label>
|
||||
<select name="calc_shipping_country" id="calc_shipping_country" class="country_to_state country_select" rel="calc_shipping_state">
|
||||
<option value=""><?php esc_html_e( 'Select a country / region…', 'bridge' ); ?></option>
|
||||
<?php
|
||||
foreach ( WC()->countries->get_shipping_countries() as $key => $value ) {
|
||||
echo '<option value="' . esc_attr( $key ) . '"' . selected( WC()->customer->get_shipping_country(), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( apply_filters( 'woocommerce_shipping_calculator_enable_state', true ) ) : ?>
|
||||
|
||||
<p class="form-row form-row-wide" id="calc_shipping_state_field">
|
||||
<?php
|
||||
$current_cc = WC()->customer->get_shipping_country();
|
||||
$current_r = WC()->customer->get_shipping_state();
|
||||
$states = WC()->countries->get_states( $current_cc );
|
||||
|
||||
if ( is_array( $states ) && empty( $states ) ) {
|
||||
?>
|
||||
<input type="hidden" name="calc_shipping_state" id="calc_shipping_state" placeholder="<?php esc_attr_e( 'State / County', 'bridge' ); ?>" />
|
||||
<?php
|
||||
} elseif ( is_array( $states ) ) {
|
||||
?>
|
||||
<span>
|
||||
<label for="calc_shipping_state" class="screen-reader-text"><?php esc_html_e( 'State / County:', 'bridge' ); ?></label>
|
||||
<select name="calc_shipping_state" class="state_select" id="calc_shipping_state" placeholder="<?php esc_attr_e( 'State / County', 'bridge' ); ?>">
|
||||
<option value=""><?php esc_html_e( 'Select a state…', 'bridge' ); ?></option>
|
||||
<?php
|
||||
foreach ( $states as $ckey => $cvalue ) {
|
||||
echo '<option value="' . esc_attr( $ckey ) . '" ' . selected( $current_r, $ckey, false ) . '>' . esc_html( $cvalue ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</span>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<label for="calc_shipping_state" class="screen-reader-text"><?php esc_html_e( 'State / County:', 'bridge' ); ?></label>
|
||||
<input type="text" class="input-text" value="<?php echo esc_attr( $current_r ); ?>" placeholder="<?php esc_attr_e( 'State / County', 'bridge' ); ?>" name="calc_shipping_state" id="calc_shipping_state" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( apply_filters( 'woocommerce_shipping_calculator_enable_city', true ) ) : ?>
|
||||
|
||||
<p class="form-row form-row-wide" id="calc_shipping_city_field">
|
||||
<label for="calc_shipping_city" class="screen-reader-text"><?php esc_html_e( 'City:', 'bridge' ); ?></label>
|
||||
<input type="text" class="input-text" value="<?php echo esc_attr( WC()->customer->get_shipping_city() ); ?>" placeholder="<?php esc_attr_e( 'City', 'bridge' ); ?>" name="calc_shipping_city" id="calc_shipping_city" />
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( apply_filters( 'woocommerce_shipping_calculator_enable_postcode', true ) ) : ?>
|
||||
|
||||
<p class="form-row form-row-wide" id="calc_shipping_postcode_field">
|
||||
<label for="calc_shipping_postcode" class="screen-reader-text"><?php esc_html_e( 'Postcode / ZIP:', 'bridge' ); ?></label>
|
||||
<input type="text" class="input-text" value="<?php echo esc_attr( WC()->customer->get_shipping_postcode() ); ?>" placeholder="<?php esc_attr_e( 'Postcode / ZIP', 'bridge' ); ?>" name="calc_shipping_postcode" id="calc_shipping_postcode" />
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<p><button type="submit" name="calc_shipping" value="1" class="button<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>"><?php esc_html_e( 'Update', 'bridge' ); ?></button></p>
|
||||
|
||||
<?php wp_nonce_field( 'woocommerce-shipping-calculator', 'woocommerce-shipping-calculator-nonce' ); ?>
|
||||
</section>
|
||||
</form>
|
||||
|
||||
<?php do_action( 'woocommerce_after_shipping_calculator' ); ?>
|
||||
Reference in New Issue
Block a user