Eshop changes 2 - by amd4ever - on WordPress WooCommerce support

This topic has 15 replies, 3 voices, and was last updated 3 years, 11 months ago ago by Olga Barlow

  • Avatar: amd4ever
    amd4ever
    Participant
    November 22, 2020 at 17:49

    hallo,
    1. we have problem with you saw recently , link at private
    2. we need at “Το Lα Ρelle προτείνει” that is related products to see only products from same category at the first raw and at the second raw all the products at same gender

    Please, contact administrator
    for this information.
    14 Answers
    Avatar: amd4ever
    amd4ever
    Participant
    November 22, 2020 at 23:07

    1. we have problem with” saw recently” in article**
    The cache plugin is the wprocket, but creates problem to “saw recently”

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    November 23, 2020 at 07:52

    Hello,

    1) Describe the problem in more detail with a screenshot.
    2) WooCommerce does not have the option to set the related products from Dashboard, it takes them automatically by category or tag – https://docs.woocommerce.com/document/related-products-up-sells-and-cross-sells/

    Regards

    Avatar: amd4ever
    amd4ever
    Participant
    November 23, 2020 at 12:22

    Add this to your functions.php or custom plugin.

    function exclude_brands_from_related( $categories ){
    // array of category id's that should be excluded
    $exclude_cats = array( '100', '101', '102');
    
    foreach( $categories as $index => $cat ){
    if( in_array( $cat->term_id, $exclude_cats ) ){
    unset($categories[$index]);
    }
    }
    
    return $categories;
    }
    
    add_filter( 'woocommerce_get_related_product_cat_terms', 'exclude_brands_from_related' );

    its will work something like this?

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    November 23, 2020 at 18:53

    Hello,

    1) Describe the issue with the Recently viewed products in more detail.
    2) Read this post https://wordpress.org/support/topic/exclude-categories-from-related-products/

    Regards

    Avatar: amd4ever
    amd4ever
    Participant
    November 24, 2020 at 00:40

    we want to exclude the categories id ‘103’, ‘102’, ‘105’, ‘100’, ‘105’, ’94’, ‘227’

    but the code is not ok:

    add_filter( ‘woocommerce_get_related_product_cat_terms’, ‘exclude_brands_from_related’ );

    function exclude_brands_from_related( $categories ){
    // array of category id’s that should be excluded
    $exclude_cats = array( ‘103’, ‘102’, ‘105’, ‘100’, ‘105’, ’94’, ‘227’);

    foreach( $categories as $index => $cat ){
    if( in_array( $cat, $exclude_cats ) ){
    unset($categories[$index]);
    }
    }

    return $categories;
    }

    add_filter( ‘woocommerce_get_related_product_cat_terms’, ‘exclude_brands_from_related’ );

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    November 24, 2020 at 14:17

    Hello,

    Try this one

    add_filter( 'woocommerce_get_related_product_cat_terms', 'exclude_brands_from_related', 20, 1 );
    
    function exclude_brands_from_related( $categories ){
    	// array of category id's that should be excluded
    	$exclude_cats = array( '103', '102', '105', '100', '105', '94', '227');
    
    	$categories = array_diff($categories, $exclude_cats);
    
    	return $categories;
    }

    Regards

    Avatar: amd4ever
    amd4ever
    Participant
    November 24, 2020 at 16:06

    we cant make it work, our functions.php now:

    <?php
    
    defined( 'ABSPATH' ) || exit( 'Direct script access denied.' );
    
    /*
    * Load theme setup
    * ******************************************************************* */
    require_once( get_template_directory() . '/theme/theme-setup.php' );
    
    /*
    * Load framework
    * ******************************************************************* */
    require_once( get_template_directory() . '/framework/init.php' );
    
    /*
    * Load theme
    * ******************************************************************* */
    require_once( get_template_directory() . '/theme/init.php' );
    
    add_filter( 'woocommerce_get_related_product_cat_terms', 'exclude_brands_from_related', 20, 1 );
    
    function exclude_brands_from_related( $categories ){
    	// array of category id's that should be excluded
    	$exclude_cats = array( '103', '102', '105', '100', '105', '94', '227');
    
    	$categories = array_diff($categories, $exclude_cats);
    
    	return $categories;
    }
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    November 24, 2020 at 20:08

    Hello,

    1) Did you add the code to parent theme functions.php? Don’t make any changes to the parent theme! Use child theme to make changes.

    2) If the code still does not work then submit customization request here, please. Because we are unable to provide support for customizations under our Support Policy.

    Regards

    Avatar: amd4ever
    amd4ever
    Participant
    November 24, 2020 at 20:21

    we havent a child theme

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    November 24, 2020 at 20:28

    Hello,

    I have installed child theme for you. Move all the changes you made in parent theme to child theme https://developer.wordpress.org/themes/advanced-topics/child-themes/
    In other case you will lose them after theme update.

    Regards

    Avatar: amd4ever
    amd4ever
    Participant
    November 25, 2020 at 13:57

    even at child theme the problem still there

    $exclude_cats = array( ‘103’, ‘102’, ‘105’, ‘100’, ‘105’, ’94’, ‘227’);

    here is our woocomrce category id

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    November 26, 2020 at 11:28

    Hello,

    Submit customization request here, please. Because we are unable to provide support for customizations under our Support Policy.

    Regards

    Avatar: amd4ever
    amd4ever
    Participant
    November 27, 2020 at 00:53

    you give us a code before. its not possible to make it work..

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    November 30, 2020 at 10:06

    Hello,

    Provide us with WP Dashboard and FTP access to your site. We’ll check your problem on an exceptional basis but if you need any other additional customization contact the customization team.

    Regards

  • Viewing 15 results - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.