Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › Inquiry Button at Cart and Checkout pages does not send to Vendor
- This topic has 6 replies, 3 voices, and was last updated 3 years, 10 months ago by Auhouse.ru.
- AuthorPosts
- May 18, 2020 at 5:10 am #132380rkostkasParticipant
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.
- May 18, 2020 at 6:27 pm #132628SushobhanKeymaster
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! - May 19, 2020 at 12:05 am #132799rkostkasParticipant
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.
- May 19, 2020 at 9:39 am #132906SushobhanKeymaster
Hi,
kindly refer to this page- https://wclovers.com/knowledgebase/wcfm-marketplace-widgets-short-codes/
Thank You! - May 21, 2020 at 7:46 pm #133929Auhouse.ruParticipant
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. - May 25, 2020 at 7:40 pm #135066SushobhanKeymaster
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! - May 26, 2020 at 1:09 pm #135321Auhouse.ruParticipant
It works thanks
- AuthorPosts
- You must be logged in to reply to this topic.