• Resolved mirwordpress

    (@mirwordpress)


    i have a url within a function that provides the user with a link to go to a main category page of products. however, I want the url to include a query string that will get to the category page & only display products with the $tag parameter (product_tag) that has been used in the function. this is a custom taxonomy ( product tags ).

    <a href="' . get_bloginfo( 'url' ) . '/'. 'product-category'. '/' . $cat_slug . '?' . urlencode($atts["tag"]) . '"';

    so the url looks like this: ( tag being testingtag ) :

    /product-category/schools/?testingtag

    however, it shows all products, and not just testingtag.

    can anybody provide me with some insight as to how I should do this?

    thank you

    • This topic was modified 4 years, 7 months ago by mirwordpress.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there 👋

    This is a fairly complex 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.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers.

    Thread Starter mirwordpress

    (@mirwordpress)

    Hi @gabrielfuentes, thank you so much for your response. I actually managed to accomplish it yesterday by appending:

    '?product_tag=' . urlencode($atts["tag"])

    to the output string. I think I was overcomplicating a simple task – or Woocommerce already had the query string in place for product tags, i just needed to write it correctly.

    thanks again 🙂

    Plugin Support abwaita a11n

    (@abwaita)

    Glad to hear you were able to solve this one – thanks for letting us know!

    I’ll mark this thread as resolved now. If you have any other questions, feel free to create a new thread.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘query strings in wordpress and woocommerce’ is closed to new replies.