init
This commit is contained in:
41
wp-content/themes/flatsome/woocommerce/cart/cart-empty.php
Normal file
41
wp-content/themes/flatsome/woocommerce/cart/cart-empty.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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/
|
||||
* @package WooCommerce/Templates
|
||||
* @version 3.5.0
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit; ?>
|
||||
<div class="text-center pt pb">
|
||||
<?php
|
||||
/**
|
||||
* @hooked wc_empty_cart_message - 10
|
||||
*/
|
||||
do_action( 'woocommerce_cart_is_empty' );
|
||||
|
||||
if ( wc_get_page_id( 'shop' ) > 0 ) : ?>
|
||||
<p class="return-to-shop">
|
||||
<a class="button primary wc-backward" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
|
||||
<?php
|
||||
/**
|
||||
* Filter "Return To Shop" text.
|
||||
*
|
||||
* @since 4.6.0
|
||||
* @param string $default_text Default text.
|
||||
*/
|
||||
echo esc_html( apply_filters( 'woocommerce_return_to_shop_text', __( 'Return to shop', 'woocommerce' ) ) );
|
||||
?>
|
||||
</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
@@ -0,0 +1,91 @@
|
||||
<?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 <?php if ( get_theme_mod( 'cart_boxed_shipping_labels', 0 ) && 1 < count( $available_methods ) ) echo 'shipping--boxed'; ?>">
|
||||
<td class="shipping__inner" colspan="2">
|
||||
<table class="shipping__table <?php if ( 1 < count( $available_methods ) ) : ?>shipping__table--multiple<?php endif; ?>">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th <?php if ( 1 < count( $available_methods ) ) : ?> colspan="2" <?php endif; ?>><?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="shipping__list woocommerce-shipping-methods">
|
||||
<?php foreach ( $available_methods as $method ) : ?>
|
||||
<li class="shipping__list_item">
|
||||
<?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 class="shipping__list_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() && get_theme_mod( 'cart_estimate_text', 1 ) ) : ?>
|
||||
<p class="woocommerce-shipping-destination">
|
||||
<?php
|
||||
if ( $formatted_destination ) {
|
||||
// Translators: $s shipping destination.
|
||||
printf( esc_html__( 'Shipping to %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' );
|
||||
$calculator_text = esc_html__( 'Change address', 'woocommerce' );
|
||||
} else {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_shipping_estimate_html', __( 'Shipping options will be updated during checkout.', 'woocommerce' ) ) );
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
elseif ( ! $has_calculated_shipping || ! $formatted_destination ) :
|
||||
if ( is_cart() && 'no' === get_option( 'woocommerce_enable_shipping_calc' ) ) {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_shipping_not_enabled_on_cart_html', __( 'Shipping costs are calculated during checkout.', 'woocommerce' ) ) );
|
||||
} else {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_shipping_may_be_available_html', __( 'Enter your address to view shipping options.', 'woocommerce' ) ) );
|
||||
}
|
||||
elseif ( ! is_cart() ) :
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_no_shipping_available_html', __( 'There are no shipping options available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'woocommerce' ) ) );
|
||||
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.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ) ) );
|
||||
$calculator_text = esc_html__( 'Enter a different address', 'woocommerce' );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php if ( $show_package_details ) : ?>
|
||||
<?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html( $package_details ) . '</small></p>'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $show_shipping_calculator ) : ?>
|
||||
<?php woocommerce_shipping_calculator( $calculator_text ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
217
wp-content/themes/flatsome/woocommerce/cart/cart.php
Normal file
217
wp-content/themes/flatsome/woocommerce/cart/cart.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<?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 3.8.0
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$row_classes = array();
|
||||
$main_classes = array();
|
||||
$sidebar_classes = array();
|
||||
|
||||
$auto_refresh = get_theme_mod( 'cart_auto_refresh' );
|
||||
$row_classes[] = 'row-large';
|
||||
$row_classes[] = 'row-divided';
|
||||
|
||||
if ( $auto_refresh ) {
|
||||
$main_classes[] = 'cart-auto-refresh';
|
||||
}
|
||||
|
||||
|
||||
$row_classes = implode( ' ', $row_classes );
|
||||
$main_classes = implode( ' ', $main_classes );
|
||||
$sidebar_classes = implode( ' ', $sidebar_classes );
|
||||
|
||||
|
||||
do_action( 'woocommerce_before_cart' ); ?>
|
||||
<div class="woocommerce row <?php echo $row_classes; ?>">
|
||||
<div class="col large-7 pb-0 <?php echo $main_classes; ?>">
|
||||
|
||||
<?php wc_print_notices(); ?>
|
||||
|
||||
<form class="woocommerce-cart-form" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
|
||||
<div class="cart-wrapper sm-touch-scroll">
|
||||
|
||||
<?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-name" colspan="3"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
|
||||
<th class="product-price"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
|
||||
<th class="product-quantity"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
|
||||
<th class="product-subtotal"><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></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
|
||||
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'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', 'woocommerce' ),
|
||||
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 $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', 'woocommerce' ); ?>">
|
||||
<?php
|
||||
if ( ! $product_permalink ) {
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_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 ), $_product->get_name() ), $cart_item, $cart_item_key ) );
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
|
||||
|
||||
// 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', 'woocommerce' ) . '</p>', $product_id ) );
|
||||
}
|
||||
|
||||
// Mobile price.
|
||||
?>
|
||||
<div class="show-for-small mobile-product-price">
|
||||
<span class="mobile-product-price__qty"><?php echo $cart_item['quantity']; ?> x </span>
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // PHPCS: XSS ok.
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="product-price" data-title="<?php esc_attr_e( 'Price', 'woocommerce' ); ?>">
|
||||
<?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', 'woocommerce' ); ?>">
|
||||
<?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', 'woocommerce' ); ?>">
|
||||
<?php
|
||||
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>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php do_action( 'woocommerce_cart_contents' ); ?>
|
||||
|
||||
<tr>
|
||||
<td colspan="6" class="actions clear">
|
||||
|
||||
<?php do_action( 'woocommerce_cart_actions' ); ?>
|
||||
|
||||
<button type="submit" class="button primary mt-0 pull-left small" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'woocommerce' ); ?>"><?php esc_html_e( 'Update cart', 'woocommerce' ); ?></button>
|
||||
|
||||
<?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' ); ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php do_action( 'woocommerce_before_cart_collaterals' ); ?>
|
||||
|
||||
<div class="cart-collaterals large-5 col pb-0">
|
||||
<?php flatsome_sticky_column_open( 'cart_sticky_sidebar' ); ?>
|
||||
|
||||
<div class="cart-sidebar col-inner <?php echo $sidebar_classes; ?>">
|
||||
<?php
|
||||
/**
|
||||
* Cart collaterals hook.
|
||||
*
|
||||
* @hooked woocommerce_cross_sell_display
|
||||
* @hooked woocommerce_cart_totals - 10
|
||||
*/
|
||||
do_action( 'woocommerce_cart_collaterals' );
|
||||
?>
|
||||
<?php if ( wc_coupons_enabled() ) { ?>
|
||||
<form class="checkout_coupon mb-0" method="post">
|
||||
<div class="coupon">
|
||||
<h3 class="widget-title"><?php echo get_flatsome_icon( 'icon-tag' ); ?> <?php esc_html_e( 'Coupon', 'woocommerce' ); ?></h3><input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" /> <input type="submit" class="is-form expand" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>" />
|
||||
<?php do_action( 'woocommerce_cart_coupon' ); ?>
|
||||
</div>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php do_action( 'flatsome_cart_sidebar' ); ?>
|
||||
</div>
|
||||
|
||||
<?php flatsome_sticky_column_close( 'cart_sticky_sidebar' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php do_action( 'woocommerce_after_cart' ); ?>
|
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Continue Shopping Button
|
||||
*
|
||||
* @package Flatsome/WooCommerce/Templates
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit; ?>
|
||||
|
||||
<div class="continue-shopping pull-left text-left">
|
||||
<a class="button-continue-shopping button primary is-outline" href="<?php echo esc_url( apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
|
||||
<?php echo ( is_rtl() ? '→' : '←' ) . ' ' . esc_html__( 'Continue shopping', 'woocommerce' ); ?>
|
||||
</a>
|
||||
</div>
|
Reference in New Issue
Block a user