Home Forums WC Vendors Pro Support sold by exc admin products

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #13903
    vadmin
    Spectator

    hi @jamie

    we were half through getting some code adjusted with Ben, but i think there wasnt support within the wc vendors core at the time.

    so we should try again now theres been updates.

    task is as follows.

    1. Only show ‘sold by’ on vendor products and in all vendor loops, emails, products etc.

    or

    2. Remove ‘sold by’ for admin listed products only, in all loops.

    heres the code Ben gave previously (below); we have tried adding it after the code mentioned here and it just creates a error so has to be removed, iv tried and tried
    so we have all the remove actions and filters in place in the child theme functions.php, so i guess now the code needs adjusting so its only applicable to the vendor and not admin listings.

    hoping you can help @jamie many thanks vadmin 🙂

    `add_action( ‘woocommerce_after_shop_loop_item’, ‘custom_template_loop_sold_by’, 9 );
    function custom_template_loop_sold_by($product_id) {
    $vendor_id = WCV_Vendors::get_vendor_from_product( $product_id );
    if ( $vendor_id != ‘3,524’ ) { // Change “1” to the admins user id #
    $sold_by = WCV_Vendors::is_vendor( $vendor_id )
    ? sprintf( ‘%s‘, WCV_Vendors::get_vendor_shop_page( $vendor_id ), WCV_Vendors::get_vendor_sold_by( $vendor_id ) )
    : get_bloginfo( ‘name’ );
    echo ‘<small class=”wcvendors_sold_by_in_loop”>’ . apply_filters(‘wcvendors_sold_by_in_loop’, __( ‘Sold by: ‘, ‘wcvendors’ )). $sold_by . ‘</small> <br />’;
    }
    }

    add_filter( ‘woocommerce_get_item_data’, ‘custom_sold_by’, 10, 2 );
    add_action( ‘woocommerce_product_meta_start’, ‘custom_sold_by_meta’, 10, 2 );
    function custom_sold_by( $values, $cart_item )
    {
    $vendor_id = $cart_item[ ‘data’ ]->post->post_author;
    if ( $vendor_id != ‘3,524’ ) { // Change “1” to the admins user id #
    $sold_by = WCV_Vendors::is_vendor( $vendor_id )
    ? sprintf( ‘%s‘, WCV_Vendors::get_vendor_shop_page( $vendor_id ), WCV_Vendors::get_vendor_sold_by( $vendor_id ) )
    : get_bloginfo( ‘name’ );
    $values[ ] = array(
    ‘name’ => apply_filters(‘wcvendors_cart_sold_by’, __( ‘Sold by’, ‘wcvendors’ )),
    ‘display’ => $sold_by,
    );
    return $values;
    }
    }

    function custom_sold_by_meta()
    {
    $vendor_id = get_the_author_meta( ‘ID’ );
    if ( $vendor_id != ‘3,524’ ) { // Change “1” to the admins user id #
    $sold_by = WCV_Vendors::is_vendor( $vendor_id )
    ? sprintf( ‘%s‘, WCV_Vendors::get_vendor_shop_page( $vendor_id ), WCV_Vendors::get_vendor_sold_by( $vendor_id ) )
    : get_bloginfo( ‘name’ );
    echo apply_filters(‘wcvendors_cart_sold_by_meta’, __( ‘Sold by: ‘, ‘wcvendors’ )) . $sold_by . ‘<br/>’;
    }
    }’

    #13953
    vadmin
    Spectator
    #13972
    Jamie
    Keymaster

    Hello,

    I need to know what the error is, you’re hooking into a woocommerce filter not any of our filters, you can also disable those filters from our free or pro plugin and do what you please including the above.

    Without knowing what the error is I can’t help sorry.

    cheers,

    Jamie.

    #13974
    vadmin
    Spectator

    hello

    the code doesnt work (what ben gave to code out the ‘sold by’ from all admin listings only, not all listings.)

    can you scan your eyes over the code above, i thought it should be simple tbf. as i said the code was written pre 2 updates ago.

    #14273
    vadmin
    Spectator

    hello @digitalchild please can you glance over the code. if you need to log in no probs but the errors are well documented on the link i supplied above. + the code iv repasted, sorry thought that was clear what the issue is, its in the post, well it is if you read what iv witten, 3 weeks on from purchase and still these matters are not resolved, also some were part of pre sales questions i might add, so i would really appreciate if we can resolve this.

    many thanks

    #14293
    Jamie
    Keymaster

    Hello,

    Firstly I cannot assist you if you don’t provide me an actual PHP error. Nowhere in the thread above have you pasted the error that you are receiving. You do mention that the the sold by is removed from all your listings. The link you provide does exactly that so the code is doing what it’s supposed to. Still you don’t provide an error you just say ‘a error’. Can a doctor assist you if you just say ‘it hurts’ but you don’t tell him where or show him ? I think not.

    Secondly this is custom code that you have requested to modify how our plugin works. This has NOTHING to do with the support that is included in the plugin. We provide code snippets to assist our users where we can. I am the primary developer on our products and as such I don’t expect Ben to be providing custom development to you for free. If the code he provided doesn’t work as expected then paste actual errors and I can assist you. I don’t know a single plugin developer that gives free custom development when users want to do things outside the functionality provided. If you believe you are entitled to free custom development you need to re-evaluate your expectations. If you cannot do the custom work we’re happy to do it for a price, if we have time available, which we currently do not.

    Saying that, we always strive to help our users with their questions even if they are outside the bounds of what we support. When you succeed we succeed. So here is the snippet that does as you requested. I have tested in my environment and confirm that it works. You will notice that this isn’t a trivial amount of code and is what I would consider custom work way beyond the scope of support.

    https://gist.github.com/digitalchild/27d1f9109e6253e109a4

    cheers,

    Jamie.

    #14360
    vadmin
    Spectator

    the code wouldn’t have been needed if we didn’t have wc vendors, as wc vendors is what puts the sold by, also sorry i thought id linked in the previous topic.

    anyway this worked perfectly, so i do thank you very much.

    #19612
    MoiMM
    Participant

    Hi Jamie,
    (Sorry i’m french and my english is very bad) 🙂

    I have try your complete code for remove Sold by on my website.

    That work … but i have a little issue on my card little window when i made roll hover

    Here a screenshot

    Best regard and happy new year !

    : )

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.