Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

add the name of the seller to the cart and on the checkout page. via php?

WCMp Advanced Frontend Manager

Resolved
Viewing 6 reply threads
  • Author
    Posts
    • #116165
      l.gan
      Participant

      Hello

      how to add the name of the seller to the cart and on the checkout page. via php? without “sold by” and “:”?

      I use the following functions to add the name of the seller in the store and on the product page:

      add_action(‘woocommerce_shop_loop_item_title’, ‘add_wcmp_vendor_name’, 5);

      add_action(‘woocommerce_single_product_summary’, ‘display_soldby_text’);

      function display_soldby_text() {
      global $post, $WCMp;
      $vendor = get_wcmp_product_vendors($post->ID);
      $general_cap = __(‘Sold By’, $WCMp->text_domain);
      if($vendor) {
      echo ‘permalink.'”>’.$general_cap.’ ‘.$vendor->user_data->display_name.’‘;
      }
      }

      Thank you.

    • #116223

      Hi,
      Please add this code in the function.php of the current active theme :

      add_action('init', 'wcmp_change_sold_by_cart_checkout');
      function wcmp_change_sold_by_cart_checkout(){
      global $WCMp;
       remove_action('woocommerce_get_item_data', array($WCMp->vendor_caps, 'add_sold_by_text_cart'), 30, 2);
       add_action('woocommerce_get_item_data', 'add_sold_by_text_cart', 30, 2);
      }
      
      function add_sold_by_text_cart($array, $cart_item) {
          if ('Enable' === get_wcmp_vendor_settings('sold_by_catalog', 'general') && apply_filters('wcmp_sold_by_text_in_cart_checkout', true, $cart_item['product_id'])) {
              $vendor = get_wcmp_product_vendors($cart_item['product_id']);
              if ($vendor) {
                  echo  '<br>' . $vendor->page_title;
                  do_action('after_sold_by_text_cart_page', $vendor);
              }
          }
          return $array;
      }
      Copy

      regards,

      • #116266
        l.gan
        Participant
        This reply has been marked as private.
    • #116260
      l.gan
      Participant
      This reply has been marked as private.
    • #116261
      l.gan
      Participant

      thanks it really works.

      Could you please help me some more – I added your function
      (and deleted the old one that I sent you earlier in this thread). I decided to just turn on the display “Enable” for sale by “” in the plugin settings and I had problems with the display “by-vendor-name-link” on the product display page and on the single product page.

      i am using theme Woodmart.

      1. The display of the product_title entry-title is duplicated with the buy product button (please see the image https://disk.yandex.ru/i/0U6yJrGP1ynXhg). The top button appears which leads to the vendor’s store page, and the bottom (as it should be) leads to the purchase of the product. Can you tell me how can I move the vendor name like in the example image? (https://disk.yandex.ru/i/l6xDOhH-jlO9OA)
      https://pafier.com/zhenskoe/

      2. on the individual product page: is now “by-vendor-name-link” displayed in “product_meta”. How can I change the position “by-vendor-name-link” to after the “product_title entry-title”?
      https://pafier.com/zhenskoe/zashhita-ot-solncza/decoration-wooden-present/

    • #116263
      l.gan
      Participant
      This reply has been marked as private.
    • #116376

      Hi,
      our replies are inline:
      1. on the individual product page: is now “by-vendor-name-link” displayed in “product_meta”. How can I change the position “by-vendor-name-link” to after the “product_title entry-title”?
      >> Can you please tell me in detailed what do you actually want and also share a screenshot so we will be able to help you out accordingly.

      2. The display of the product_title entry-title is duplicated with the buy product button
      >> For this you have to add your custom code and Woocommerce hook and filter for your custom modification. Kindly follow the link – https://www.businessbloomer.com/woocommerce-visual-hook-guide-archiveshopcat-page/ or contact your theme developer to fix this issue.

      Regards,

    • #120894

      Hi, we haven’t heard back from you. Hope the issue is resolved.

      If you need any further help, please create another thread.

Viewing 6 reply threads

The topic ‘add the name of the seller to the cart and on the checkout page. via php?’ is closed to new replies.