If you like our themes and support, please SHARE our website! https://theme-sky.com/wordpress-themes/

Okay
  Public Ticket #1248521
How can i modify related products
Closed

Comments

  •  2
    Hassan started the conversation

    Hello,

    First i want to remove your hook 

    add_filter('woocommerce_output_related_products_args', 'sanzo_output_related_products_args_filter');

    And want to define my own. Please help me how can i remove this. Secodly, which does not related to your theme but in case you can easily help me. How can i modify these args of this filter so that i only get products related to current product. Actually i have perfumes and each perfume have different weights. Their title are different from their last words where it add 2 oz, 1.5 oz etc. I want to show variants of each products in its related products so i want to get related products similar to title of current product. Is it something you can help me with. 

    https://www.sensationalone.com/product/alfred-sung-by-alfred-sung-eau-de-toilette-spray-tester-34-oz-fx416679/


    Thank you

  •  568
    Stormit replied

    Hi Hassan,

    You don't need to remove it. You can add a new function and add it after my function. For example, you create a function named sanzo_custom_output_related_products_args_filter. You will use the code below

    add_filter('woocommerce_output_related_products_args', 'sanzo_custom_output_related_products_args_filter', 20);
    

    Your function will be called after my function. So it can override my function.

    WooCommerce gets related products based on categories and tags of the current product. So, you can add your products to the same category or tag.

    Best regards,