up-sells.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Single Product Up-Sells
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/single-product/up-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. * @author WooThemes
  15. * @package WooCommerce/Templates
  16. * @version 3.0.0
  17. */
  18. if ( ! defined( 'ABSPATH' ) ) {
  19. exit;
  20. }
  21. if ( ! $upsells ) {
  22. return;
  23. }
  24. global $product, $woocommerce_loop;
  25. $upsells_ids = array();
  26. foreach ( $upsells as $upsell ) {
  27. $upsells_ids[] = $upsell->get_id();
  28. }
  29. $args = apply_filters( 'woocommerce_related_products_args', array(
  30. 'post_type' => 'product',
  31. 'ignore_sticky_posts' => 1,
  32. 'no_found_rows' => 1,
  33. 'posts_per_page' => $posts_per_page,
  34. 'orderby' => $orderby,
  35. 'post__in' => $upsells_ids,
  36. 'post__not_in' => array( $product->get_id() ),
  37. ) );
  38. $products = new WP_Query( $args );
  39. $columns = intval( $columns );
  40. $max_columns = $columns;
  41. if ( 0 === $columns ) {
  42. $columns = 4; // this is used for thumbnails only
  43. }
  44. $woocommerce_loop['columns'] = $columns;
  45. ?>
  46. <section class="up-sells upsells products">
  47. <div class="limit-wrapper vamtam-box-outer-padding">
  48. <h4 class="vamtam-wc-related-title"><?php esc_html_e( 'You may also like&hellip;', 'vamtam-consulting' ) ?></h4>
  49. </div>
  50. <div class="vamtam-related-content">
  51. <div class="limit-wrapper vamtam-box-outer-padding">
  52. <?php include locate_template( array( 'templates/woocommerce-scrollable/loop.php' ) ); ?>
  53. </div>
  54. </div>
  55. </section>
  56. <?php