3
votes

I'm building a website where the client doesn't need to add products he just wants to charge people a set fee based on some specifications he gave me. I'd like to use WooCommerce since the payment gateway the client requires is already available with WooCommerce so i will need to purchase that gateway and set the rest myself.

This is the scenario i'm planning to build: on submission of a form, a price/total is added to the cart, the user is then redirected to the cart and pays the fee. The thing i'm not sure how to do is the "addition of the fee" to the cart without adding any product, i've found the hook "woocommerce_before_calculate_totals" but i'm not sure it will work with no product added.

Has anybody ever achieved such thing? Or are there any other ways to achieve this? Let's think of it the same as it happens with the "name your price" plugin but without a product.

Thank you.

1
Do you think either one of these plugins would accomplish what you are looking for? wordpress.org/plugins/… or there is this which is a purchased plugin ignitewoo.com/woocommerce-extensions-plugins/… - Robert Lee
They are similar to what i'm trying to do however, they both require a product to be added to the cart, instead i'm trying to do a checkout process without any real product added to the cart. Not sure if i explained myself correctly. - tdp

1 Answers

2
votes

In my WC experience, there is no way for an "item" to be added to a cart without it being a "product" as products are the custom post type WooCommerce uses. However, there are a couple ways your goal can be achieved with minimal product catalog management.

  1. Formidable Forms Pro offers an excellent solution by way of tying their forms into a single WooCommerce Product which then, based on the form's values, calculates a total and sends the item to the cart. You can use their drag and drop builder to configure calculated fields, and then hide those fields visually on the frontend. I believe Gravity Forms offers a similar solution.
  2. You may use WooCommerce Product Addons to create additional fields attached to the product such as checkboxes, selects, radio buttons, or custom text fields. These additional fields can have price modifications associated with them, allowing the product to be customized and added to the cart based on the user's selection.

Both of these options only require one "product" for them to function properly, and then you can style the experience to make the process feel less shopping cart-like.