• Resolved familykrists

    (@familykrists)


    Hello!

    Under the product I have the label with the vendor’s name. Would it be possible to also add the main category (I have only one category per product) in the label so it goes like “Created by [vendor name] in [category name]”?

    Thank you!

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jamie

    (@digitalchild)

    Hello,

    Yes, you can do this by hooking into the wcvendors_cart_sold_by filter. This provides the product_id, vendor_id and the sold by separate.

    You would need to do the following:

    1. Get the category for the product.
    2. Reconstruct the label with the new structure
    3. Return this string.

    The function is defined in our source code in wc-vendors/classes/front/class-vendor-cart.php in the function called sold_by.

    cheers,

    Jamie.

    Thread Starter familykrists

    (@familykrists)

    Hi Jamie!

    Thanks for getting back!

    I’m no pro dev, sorry for that!
    Could you please be more specific what line of code I need to add?

    To be more precise – I would like to have the label “Created by [vendor name] in [category name]” only in the products archive (Shop). In open product page the label could stay the same.

    Best,
    Krists

    Plugin Author Jamie

    (@digitalchild)

    Hi @familykrists

    We don’t usually provide custom code snippets for on forums here. It would open the flood gates for people to ask for free customisation that our small team cannot sustain.

    With that being said, we have an existing snippet that is close that I was able to quickly modify to get what you require.

    I’ve created a new docs article for this.

    https://docs.wcvendors.com/docs/uncategorized/change-the-sold-by-label-on-the-product-archive/

    cheers,

    Jamie.

    Thread Starter familykrists

    (@familykrists)

    Thanks Jamie! This is a big help!

    Plugin Author Jamie

    (@digitalchild)

    Hi @familykrists

    Happy to help. If you have a moment, it would be great if you could write a review of your experience. It helps others know about our awesome support and product.

    https://wordpress.org/support/view/plugin-reviews/wc-vendors#postform

    Have a great weekend.

    Cheers,

    Jamie.

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