cart-empty.php
7 years ago
cart-item-data.php
6 years ago
cart-shipping.php
6 years ago
cart-totals.php
6 years ago
cart.php
6 years ago
cross-sells.php
6 years ago
mini-cart.php
6 years ago
proceed-to-checkout-button.php
7 years ago
shipping-calculator.php
6 years ago
cross-sells.php
47 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Cross-sells |
| 4 | * |
| 5 | * This template can be overridden by copying it to yourtheme/woocommerce/cart/cross-sells.php. |
| 6 | * |
| 7 | * HOWEVER, on occasion WooCommerce will need to update template files and you |
| 8 | * (the theme developer) will need to copy the new files to your theme to |
| 9 | * maintain compatibility. We try to do this as little as possible, but it does |
| 10 | * happen. When this occurs the version of the template file will be bumped and |
| 11 | * the readme will list any important changes. |
| 12 | * |
| 13 | * @see https://docs.woocommerce.com/document/template-structure/ |
| 14 | * @package WooCommerce/Templates |
| 15 | * @version 3.0.0 |
| 16 | */ |
| 17 | |
| 18 | defined( 'ABSPATH' ) || exit; |
| 19 | |
| 20 | if ( $cross_sells ) : ?> |
| 21 | |
| 22 | <div class="cross-sells"> |
| 23 | |
| 24 | <h2><?php esc_html_e( 'You may be interested in…', 'woocommerce' ); ?></h2> |
| 25 | |
| 26 | <?php woocommerce_product_loop_start(); ?> |
| 27 | |
| 28 | <?php foreach ( $cross_sells as $cross_sell ) : ?> |
| 29 | |
| 30 | <?php |
| 31 | $post_object = get_post( $cross_sell->get_id() ); |
| 32 | |
| 33 | setup_postdata( $GLOBALS['post'] =& $post_object ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited, Squiz.PHP.DisallowMultipleAssignments.Found |
| 34 | |
| 35 | wc_get_template_part( 'content', 'product' ); |
| 36 | ?> |
| 37 | |
| 38 | <?php endforeach; ?> |
| 39 | |
| 40 | <?php woocommerce_product_loop_end(); ?> |
| 41 | |
| 42 | </div> |
| 43 | <?php |
| 44 | endif; |
| 45 | |
| 46 | wp_reset_postdata(); |
| 47 |