-
-
Hello.
I have a strange problem using woocommerce.
Even if i have 8-10 products on the same category, i have 2 related only on every product in the shop.
I’ve tried some solution with the functions.php file, but no one seems to work.
So i think there is some theme’s functions to get at least 4 related products on my product page.Link to one of our products: https://www.biornshoes.it/prodotto/doppia-fibia-camoscio-testa-di-moro/
How can i do that?
Waiting for your reply.
Thank you in advance.
Gianmaria Generoso.
-
Hello,
Can you please provide some ftp credentials as well? We need to check the woocommerce files.
You can add them into your profile data, just like the wp credentials.
Let us know.Best regards!
-
Hello,
Sorry but i can’t give you ftp credentials, but i can give you a full WordPress admin access, that you already have in my account informations.
If you don’t find what are you looking for, i can paste directly here the whole file you need to read.Thank you in advance.
Gianmaria Generoso
-
Hello.
I’m still waiting for your response.
Thank you in advance.Gianmaria Generoso
-
-
Hello.
Are there any news about this?
Thank you in advance. -
Hello,
Please go to file wp-content\plugins\woocommerce\includes\wc-template-functions.php and find this function:
function woocommerce_cross_sell_display( $posts_per_page = 2, $columns = 2, $orderby = 'rand' )
edit post per page and columns value from 2 to 4. Save changes and refresh cart page.Let us know.
Best regards!
-
Hello.
Isn’t there a way to do this with actions and hooks in functions.php file?
If we do this, we need to redo the mod every time we update wordpress, and you know wp and woocommerce has a lot of updates.Thanks in advance.
Gianmaria Generoso. -
Hello,
Sorry but this as a script controlled solely by the plugin itself(wp updates will not affect it). It is not overwritten by theme. This is all we can do for you as further coding is not included in support.
Note: However, i have notified the developers and we will try to include a fix for this situation in theme’s future updates.
Best regards!
- This reply was modified 6 years, 4 months ago by Mirela.
-
Hello.
I’ve looked ad the file you told, but i didn’t found the line you’re talking about.
I have something similar, but even if i changed column to 4 and limit to 4, it’s not working.if ( ! function_exists( 'woocommerce_cross_sell_display' ) ) { /** * Output the cart cross-sells. * * @param int $limit (default: 2) * @param int $columns (default: 2) * @param string $orderby (default: 'rand') * @param string $order (default: 'desc') */ function woocommerce_cross_sell_display( $limit = 4, $columns = 4, $orderby = 'name', $order = 'desc' ) { global $woocommerce_loop; if ( is_checkout() ) { return; } // Get visble cross sells then sort them at random. $cross_sells = array_filter( array_map( 'wc_get_product', WC()->cart->get_cross_sells() ), 'wc_products_array_filter_visible' ); $woocommerce_loop['name'] = 'cross-sells'; $woocommerce_loop['columns'] = apply_filters( 'woocommerce_cross_sells_columns', $columns ); // Handle orderby and limit results. $orderby = apply_filters( 'woocommerce_cross_sells_orderby', $orderby ); $cross_sells = wc_products_array_orderby( $cross_sells, $orderby, $order ); $limit = apply_filters( 'woocommerce_cross_sells_total', $limit ); $cross_sells = $limit > 0 ? array_slice( $cross_sells, 0, $limit ) : $cross_sells; wc_get_template( 'cart/cross-sells.php', array( 'cross_sells' => $cross_sells, // Not used now, but used in previous version of up-sells.php. 'posts_per_page' => $limit, 'orderby' => $orderby, 'columns' => $columns, ) ); } }
-
Hello,
Please check out this screenshot: https://postimg.org/image/5cttpguzf/
I have pointed out the changes i made to the same file. I tested it and on our part this works fine. All 4 related products are being show. In your part however, i see the 4 products being shown in 3 columns.
So i disabled every woocommerce related third party plugin, and the result was like my result. See screenshot: https://postimg.org/image/acr9xk5sr/
I activated the third party woocommerce plugins one at a time and found out that this plugin: Booster for Woocommerce was responsible for the change.Please check your site.
Best regards!
-
Hello, and thank you for you support.
I have only one more question.
Why related products are sometime totally unrelated to the product shown?
I see related product from other categories, that are not related to the product you are seeing.
Thank you in advance.
-
-
You must be logged in to reply to this topic.