• Resolved bvado

    (@bvado)


    Hello and thank you for your wonderful plugin. It suits my needs perfectly.

    I’m trying to show the allergens in the woocommerce category block. It doesn’t use a hook so I have to override its content ??

    I try to do this using the method allergens_list_910_show_allergen_with_id, as it is used in hooks.php: there’s a line that says
    $html = allergens_list_910_show_allergen_with_id($product_id);

    …but it doesn’t work, simply because in the method, the result $html isn’t returned but “echoed”:

    $html = apply_filters('allergens_list_modify_display', $html); echo $html;

    I believe that it should be return $html;. Then the method works! And I believe the shortcode doesn’t work because of this reason as well…

    I’d modify it myself and submit a pull request, but the code is in svn, not git and I don’t have any svn client set up anymore, hence this support ticket

    I hope this suggestion is an improvement.
    Kind regards!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Anonymous User 17720058

    (@anonymized-17720058)

    You are absolutely right, thank you for noticing!
    The new version (1.15) is now available, where I modified the allergens_list_910_show_allergen_with_id () function and added an allergens_list_910_get_allergen_with_id () function. I think you need the latter.

    I think it’s a good idea to display allergens in the WooCommerce category. I will include this in the next version. I think this is good if all the allergen elements that are present in any of the products in the category appear. What do you think?

    Anonymous User 17720058

    (@anonymized-17720058)

    You can now download the new version, which also includes allergens in the products in this category.
    = 1.16 =

    • Add allergens-category shortcode [allergens-category <id="$category_id">]
    • Add allergens_list_910_show_allergen_with_category_id() function
    • Add allergens_list_910_get_allergen_with_category_id() function

    More description here: https://wpdemo.dovi42.hu/allergens-list-en/

    • This reply was modified 4 years, 1 month ago by Anonymous User 17720058.
    Thread Starter bvado

    (@bvado)

    That was fast, thank you! ??

    Anonymous User 17720058

    (@anonymized-17720058)

    You’re very welcome.
    Please don’t forget to rate the plugin!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Method ‘show allergen with id’ doesn’t return result’ is closed to new replies.