products - Output cross sells on separated page in Woocommerce 3.0.0 -


in woocommerce shop, when user add product cart, redirected "accessories" page contained cross sells products, used:

<?php wc_get_template( 'cart/cross-sells.php' ); ?> 

that worked fine until woo has been updated 3.0.0. im getting:

notice: undefined variable: cross_sells

is there better way how output cross sells on separated page?

if no: im using old template (see below), seems working, im not sure if right way. if should tweak cross-sells v3.0.0 template, can that?

    if ( ! defined( 'abspath' ) ) {     exit; }  global $product, $woocommerce_loop;  if ( ! $crosssells = wc()->cart->get_cross_sells() ) {     return; }  $args = array(     'post_type'           => 'product',     'ignore_sticky_posts' => 1,     'no_found_rows'       => 1,     'post__in'            => $crosssells,     'meta_query'          => wc()->query->get_meta_query() );  $products                    = new wp_query( $args ); $woocommerce_loop['name']    = 'cross-sells';  if ( $products->have_posts() ) : ?>      <div class="cross-sells">          <?php woocommerce_product_loop_start(); ?>              <?php while ( $products->have_posts() ) : $products->the_post(); ?>                  <?php wc_get_template_part( 'content', 'product' ); ?>              <?php endwhile; // end of loop. ?>          <?php woocommerce_product_loop_end(); ?>      </div>  <?php endif;  wp_reset_query(); 

thanks


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -