• Resolved Mark Howells-Mead

    (@markhowellsmead)


    I’d like to modify the query on the “products by tag” block, so that the query matches with AND logic and not OR logic. This modifies the query as I’d like, but it has no effect on the products being displayed. (Is showing 3, should only show 1.) https://gist.github.com/markhowellsmead/86711ff842fcb9ed8b13d6218c6545c3

    The file “result.txt” in that Gist shows the modified query. But the block output isn’t being affected.

    Have I missed something? Is there a better way to modify the block’s tax_query? I’ve deactivated woocommerce_blocks_product_grid_is_cacheable and tried woocommerce_product_query_tax_query too, but none of this seems to be working…

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    I’d like to modify the query on the “products by tag” block, so that the query matches with AND logic and not OR logic.

    To clarify, are you referring to

    if ($condition[‘taxonomy’] === ‘product_tag’ && count($condition[‘terms’]) > 1)

    ?

    May I ask did you modify that code? if so, can you provide your code? So that we can get a better idea?

    We’ll look forward to hearing from you.

    Thread Starter Mark Howells-Mead

    (@markhowellsmead)

    I’m not sure what you mean: I wrote that code, I didn’t modify it. The link to the code is in my original comment. Thanks for your feedback.

    Hi,
    Thanks for your clarification.

    Since this is a development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    We recommend the following pages/resources as well:
    The WooCommerce Developer Resources Portal.
    WooCommerce Facebook group.
    — The #developers channel of the WooCommerce Community Slack.

    Thread Starter Mark Howells-Mead

    (@markhowellsmead)

    Thanks for your feedback. I’ve cross-posted to the community Slack channel.

    Plugin Support con

    (@conschneider)

    Engineer

    Hi Mark,

    When you say “products by tag” block – you mean this block here: https://d.pr/i/M5bS88 – correct?

    so that the query matches with AND logic and not OR logic.

    To my knowledge this setting manages exactly that: https://d.pr/i/SkikSY (?).

    Kind regards,

    Thread Starter Mark Howells-Mead

    (@markhowellsmead)

    Exactly that! 🤦‍♂️ Thanks! The question remains though; how to programmatically modify the query on a block like this.

    Hi @markhowellsmead

    Exactly that!

    Thanks for confirming.

    The question remains though; how to programmatically modify the query on a block like this

    Kindly be informed that support for custom coding is beyond the scope of support we are able to provide in this forum. This particular forum is for questions that are related to the WooCommerce core features.

    You can get development related assistance at the channels mentioned above.

    For direct assistance with code customizations, we recommend consulting with the WooCommerce Customizations Partners. https://woocommerce.com/customizations/

    Thread Starter Mark Howells-Mead

    (@markhowellsmead)

    Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to modify the “products by tag” tax_query’ is closed to new replies.