Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #33367

    Xavier D
    Participant

    Hi!

    I’m trying to override the file:
    x/framework/functions/global/woocommerce.php

    By placing a copy of it (modified, of course) in:
    x-child-integrity-light/framework/functions/global/woocommerce.php

    But it’s not working 🙁 It still takes the parent theme file…

    Is there any way to do this? Something I’m doing wrong?

    Thanks!

    #33449

    Xavier D
    Participant

    Some more information…

    That’s because I wanted to add extra content and HTML markup between a product image and its title.

    If I try to do it using:

    add_action('woocommerce_before_shop_loop_item_title','madeincat_home_productbar', 5);

    It’ll be adding the content over the image 🙁

    Any ideas?

    Thanks!

    #33753

    Support
    Member

    Hi there!

    Thank you for using the theme!

    Do you mind if you post a screenshot of what you’re trying to do? Maybe this will help, add this on the child theme’s functions.php:

    add_filter( 'woocommerce_before_single_product', 'x_woocommerce_add_before_single_product', 99 );
    
    function x_woocommerce_add_before_single_product() {
     echo "SOMETHING HERE";	
    }

    I hope that helps. Cheers!

    #34730

    Xavier D
    Participant

    Hi! I finally found a workarround, but now i’m stuck again in another place… And need again to override something that’s on

    x/framework/functions/global/woocommerce.php

    As I see in “x_woocommerce_shop_thumbnail” function stored in that file, it’s taking the “entry-full-” image.

    I would like to take the default catalog image, as I have different image proportions for shop loop and single product pages…

    If I comment the two lines:

    remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
    add_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail', 10 );
    

    Then Woocommerce uses its default image sizes and it all works perfect, but I’d preffer to avoid editing files in the main theme…

    Any idea?

    🙂 Thanks for your AWESOME support!

    #34882

    Rad
    Moderator

    Hi Xavier,

    Thank you very much! You could try this at your child theme’s functions.php.

    remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail', 10 );
    add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );

    This is the reversed version of the code you commented.

    Hope this helps. 🙂

    #34884

    Xavier D
    Participant

    Hi!

    This was the first thing I tried… but nothing happened 🙁

    #35016

    Rad
    Moderator

    Hi Xavier,

    Oh yes, it will not work as child theme’s functions.php will be first loaded thus nothing to remove yet.

    But it works when placed at /x/framework/functions/{STACK}.php

    It represent each stack’s functions.php

    #35062

    Xavier D
    Participant

    Yep,

    The question is, when I’ll update the theme, I should remember to change the file

    /x/framework/functions/{STACK}.php

    again? Or it’ll keep the changes?

    Thanks!

    #35070

    Xavier D
    Participant

    Also, if you think there is another way to achieve this… This was just my idea on how to do it 🙂

    The point is, I have set up this sizes in woocommerce config:

    Woocommerce image sizes

    Because in my shop, I would like to use different image proportions for home:

    Home shop

    And product detail:

    Product detail

    Any help would be much appreciated!

    Thanks!!! 🙂

    #35185

    Rad
    Moderator

    Hi Xavier,

    Yes, it will be overwritten by next update. And tried another approach, added at child theme’s function.php and is working.

    add_action('wp_head', 'change_wc_thumb_hooks');
    
    function change_wc_thumb_hooks() {
    	remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail', 10);
    	add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);	
    }

    And other way to achieve something like at those sample will be template and hook editing.

    Thank you.

    #35508

    Xavier D
    Participant

    Hey!!! Thanks!!! That really worked great!!!!!! 🙂

    #35708

    Christian
    Moderator

    You’re welcome Xavier.