We're merging with GenerateBlocks! Learn more here.

[Support request] Woocommerce category or tag as parameter

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Woocommerce category or tag as parameter

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #30831
    luisa
    Participant

    Maybe there is thread yet, but I don’t know how to find it.
    Can I give the category or tag as parameter to wpsp_display ()? It would be great if a woocommerce customer clicks on a term of this kind to find the corresponding items.
    Thanks in advance!

    #30869
    elvin
    Moderator

    Hi Luisa,

    Can I give the category or tag as parameter to wpsp_display ()?

    Sure you can. It’s basically writing a query args array like the ones you see here – https://developer.wordpress.org/reference/classes/wp_query/

    Example:

        $settings = array(
            'post_type' => 'product',
            'taxonomy' => 'product_cat or product_tag',
            'tax_term' => 'category slug or tag slug here',
        );
    
        wpsp_display( 1699, $settings );

    Where 1699 is the WPSP id.

    It would be great if a woocommerce customer clicks on a term of this kind to find the corresponding items.

    The post meta that displays links to the corresponding category archive of the product. In a sense, doesn’t the category archive of a product serve as a list of “corresponding items”? 🙂

    #30877
    luisa
    Participant

    Thank you very much! I’m not a skilled PHP developer and I needed the right hint 🙂
    Indeed, on the WooCommerce product page you can click on categories and tags, but I would like to show them with WPSP instead, as I have more control on displaying things.

    #30893
    elvin
    Moderator

    Thank you very much! I’m not a skilled PHP developer and I needed the right hint 🙂
    Indeed, on the WooCommerce product page you can click on categories and tags, but I would like to show them with WPSP instead, as I have more control on displaying things.

    In that case you may have to do a redirection to your page with WPSP listsing(which will effectively make the default product cat archive page useless) or hook in your own custom “meta links” as no WP core function would be aware which page serves WPSP listings of “corresponding items”.

    #30898
    luisa
    Participant

    In that case you may have to do a redirection to your page with WPSP listsing(which will effectively make the default product cat archive page useless) or hook in your own custom “meta links” as no WP core function would be aware which page serves WPSP listings of “corresponding items”.

    yes, you hit the target. I don’t know if I’m able to do it, but I’ll give a try. Thanks for helping.

    #30981
    elvin
    Moderator

    There are redirection plugins you can use. I believe this won’t need coding.

    If you’re using Yoast or Rankmath for SEO, it actually comes with a redirection feature. You can use that. 🙂

    #31003
    luisa
    Participant

    I have Yoast, I’ll check ! Thanks a lot, very helpful 🙂

    #31006
    elvin
    Moderator

    No problem. 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.