Support Forum
Support › MB Frontend Submission › How can I hide form
Dear Support,
I would like to know how to hide form and display message to say that please select some products and then comeback ( hide submit button )
I am using woocommerce for catalog base, I want to select some products and relate user data by asking questions to users with the help of your plugin. So I tried to look at filters and I am not able to find them so decided to replace all fields with a single custom_html field having message for user but when I check for the cart it seems woocommerce is not loaded its object yet and I get empty cart always event if I added items to cart. It seems Meta box loads before woocommerce. Can you please help me in this.
Also I want to hide submit button before all form fields are filled in can I achieve that with Metabox conditional logic?
Regards,
Calpaq
Hi Calpaq,
Let me try to understand your problem. Are you trying to put a frontend form in the Cart page? And if there's no products in the cart, you'd want to show a message to users. Otherwise, they need to fill in all the form fields so they can see the Submit button? Am I right?
Dear Support,
I am making a custom shop in which products in woocommerce which are complete products in combination with users form input. So first I choose products or elements of complete product on the archive page by adding them to cart, then I go to the mb-frontend form shortcode page where in two steps I ask for user input and add the collected information to cart items. In these steps I have to display cart item names and collect the information around it. So when there is nothing in cart I can't display the form by assuming user is on this page has not gone through the process and display a message to send him back to the first step (selection of products from archive)
Regards,
Calpaq
Hi Calpaq, I got it. I think in this case, it's better to use some conditional check in your template. Something like this:
if ( your_is_cart_empty() ) {
echo 'Please go back and add some items';
} else {
echo do_shortcode( '[mb_frontend_form id="meta-box-id"]' );
}
It's much easier than filter the form or change the fields inside.
Okay Thanks