Inquiry Button at Cart and Checkout pages does not send to Vendor

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM Inquiry Button at Cart and Checkout pages does not send to Vendor

Viewing 6 reply threads
  • Author
    Posts
    • #132380
      rkostkas
      Participant

      Hi, I’ve used shortcode to place a inquiry butoon on the Cart an Checkout page. However, I’ve noticed that only the website admin receives the inquiries send from these two pages unlike those sent from the product page which the product vendor also receives the inquiries. Any way to make it so that product vendor also receives the inquires from Cart and Checkout pages. This would make more sense since any iqueries at Cart and Checkout are also related to the product vendor. This is critical feature for me. Please help, thanks in advance.

    • #132628
      Sushobhan
      Keymaster

      Hi,
      Thanks for getting in touch with us!
      Use the following snippet for this purpose. It will add an inquiry button against each cart item like this- https://imgur.com/NPSvEY9.

      add_filter( 'woocommerce_cart_item_subtotal', function($price, $cart_item, $cart_item_key) {
          $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
          $vendor_id = wcfm_get_vendor_id_by_post( $product_id );
          if ( ! wcfm_is_vendor( $vendor_id ) ) {
              $vendor_id = 0;
          }
          return $price . do_shortcode( "[wcfm_inquiry product='{$product_id}' store='{$vendor_id}']" );
      }, 999, 3 );

      Add this code to your child theme’s functions.php
      In case you do not have a child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/
      Let me know how this goes.
      Thanks!

    • #132799
      rkostkas
      Participant

      Thanks Sushobhan! This helps, but I want to have the inquiry button by the Shipping information, which I have already done, but just want to be able to send inquiry to the product vendor in addition to WCFM Admin. However, looking at your code, it appears that if use the shortcode [wcfm_inquiry store='{$vendor_id}'], then an inquiry email will be sent to the product vendor, correct? Also, please let me know where I can find these shortcode syntax so know what what to do in the future without having to bother you. Thanks so much for your help.

    • #132906
      Sushobhan
      Keymaster
    • #133929
      Auhouse.ru
      Participant

      Sushobhan. The code works fine on the cart page, on the checkout page the button does not work

      Attachments:
      You must be logged in to view attached files.
    • #135066
      Sushobhan
      Keymaster

      Hi,
      Kindly use the following snippet to make it work on the checkout page-

      add_action( 'woocommerce_after_checkout_form', function() {
          ?>
          <script>
              jQuery( function ( $ ) {
                if ( $( '.woocommerce-checkout' ).find('.wcfm_catalog_enquiry' ).length ) {
                    $( '.woocommerce-checkout' ).on( 'click', '.wcfm_catalog_enquiry', function ( e ) {
                      e.preventDefault();
      
                      $store = $( this ).data( 'store' );
                      $product = $( this ).data( 'product' );
      
                      $.colorbox( { inline: true, href: "#enquiry_form_wrapper", width: $popup_width,
                        onComplete: function () {
      
                          $( '#wcfm_enquiry_form' ).find( '#enquiry_vendor_id' ).val( $store );
                          $( '#wcfm_enquiry_form' ).find( '#enquiry_product_id' ).val( $product );
      
                          if ( jQuery( '.anr_captcha_field' ).length > 0 ) {
                            if ( typeof grecaptcha != "undefined" ) {
                              if ( $wcfm_anr_loaded ) {
                                grecaptcha.reset();
                              } else {
                                wcfm_anr_onloadCallback();
                              }
                              $wcfm_anr_loaded = true;
                            }
                          }
      
                        }
                      } );
                    } );
                }
              } );
          </script>
          <?php
      } );

      Add this code in combination with the previous code to make it work on checkout page.
      Thanks!

    • #135321
      Auhouse.ru
      Participant

      It works thanks

Viewing 6 reply threads
  • You must be logged in to reply to this topic.