Woocommerce: How to remove category on ALL pages - woocommerce

I am using Woocommerce in combination with Booked to make paid reservations for our Escape Rooms. The products that i sell are just the different booking options such as: Room A | 4 Persons | €50
When making a reservation (buying the woocommerce product) it automatically shows "Category: No category". I don't want that because when people click the "no category" they get to see the categorypage that i don't use. The pages "shop" and "all products" are also not used for my purpose.
How can i remove the categories from the following pages?: Cart, Checkout
Picture of the Cart
Picture of the Checkout
Is it possible to add some lines in the Functions.php of the theme which makes the categories disappear? I already added some 3 lines that hide three columns (download-remaining, download-product and download-expires) and it works perfect for my purpose!
Here is the code i have used (copied from another article ;))
add_action( 'woocommerce_account_downloads_columns',
'custom_downloads_columns', 10, 1 ); // Orders and account
add_action( 'woocommerce_email_downloads_columns',
'custom_downloads_columns', 10, 1 ); // Email notifications
function custom_downloads_columns( $columns ){
// Removing "Download expires" column
if(isset($columns['download-expires']))
unset($columns['download-expires']);
// Removing "Download remaining" column
if(isset($columns['download-remaining']))
unset($columns['download-remaining']);
if(isset($columns['download-product']))
unset($columns['download-product']);
return $columns;
}
This is the website: https://escape-outdoor.nl

Related

Change items tax rate in WooCommerce order admin based on custom field

My customers have to make a choice during the checkout to select if they are vat exempted or not. i use custom fields. I tried 3 solutions, all worked well:
Change items tax rate in WooCommerce checkout based on radio buttons
Add Tax Exempt form on checkout in woocommerce
and the best for me:
`
add_action( 'woocommerce_checkout_update_order_review', 'bbloomer_taxexempt_checkout_based_on_zip' );
function bbloomer_taxexempt_checkout_based_on_zip( $post_data ) {
WC()->customer->set_is_vat_exempt( false );
parse_str( $post_data, $output );
if ( $output['fsbdd_check_exotva'] === 'OUI' ) WC()->customer->set_is_vat_exempt( true );
}
`
But I can't change this setting in the woocommerce order admin page. if the customer was wrong or I need to edit the order manually I would like the VAT to change depending on this custom field.
I can manage the custom field with a metabox in the order backend (from metabox.io plugin). But there is no effect on the VAT. i would like the cart to be recalculate (recalculate button) once I have changed and saved the custom field value.

Add as separate cart row for a product with custom data in Woocommerce review order (checkout) and cart total (cart) pages

I currently need to sell a service with a subservice as option :
I have hadded a product panel & 2 meta for my option and its price.
If the user checks a checkbox in the product page, then the option is added to the cart page, the checkout page, thank you page, email and so on...
My problem is that i actually can update the initial product price in the product row, in cart & checkout tables but i need to :
1 : insert the additionnal service (the option) as a separate row in the checkout review order table and in the cart total table;
2 : dislay initial product price in the product row and udpdate only the total adding the option price in those 2 tables.
I'm really stuck here, any help would be great. Thank's
OK,
For the solution is quiet simple :
1 : add a product dropdow in admin tab to let user choose a linked product as a product option and register its ID a product meta;
2 : use woocommerce_add_to_cart_validation to intercept the option checkbox value from the product page and add the product option to cart from the initial product meta :
add_action( 'woocommerce_add_to_cart_validation', 'my_cart_validation' );
function my_cart_validation(){
if( isset( $_POST['my-service-option'] ) ){
WC()->cart->add_to_cart( get_post_meta( $_POST['add-to-cart'], 'service-option', true ) );
}
}
3 : If the optional service is not supposed to be displayed in the shop loop, just remove it from the WC Query :
add_action( 'woocommerce_product_query', 'remove_optional_services' );
function remove_optional_services( $q ){
$not_in = $q->get('post__not_in' );
array_push( $not_in, 75 ); // you can grab your product ids from an option or whatever fits your needs
$q->set('post__not_in', $not_in);
}
The good thing is you keep a simple control on taxes and prices with this method.

Woocommerce - Catalogue Add to Cart button - change default quantity for specific category

On the woocommerce shop catalogue page is it possible to have the 'add to cart' button default to six rather than one, but only for a specific category? Selling wine and want it to add 6 bottles at a time, but also selling other items that will be sold individually.
Add this code to functions.php in your theme. Keep in mind that if you update your theme, this edit might be lost. So either save it somewhere to add it again or create a child theme and add it there.
add_filter("woocommerce_quantity_input_args", function($args, $product){
if(!is_cart() && has_term("wine-bottles", "product_cat", $product->get_id())) {
$args['input_value'] = 6;
}
return $args;
}, 10, 2);
Replace "wine-bottles" with the actual name, slug or ID of your category.
This will make the default quantity value be 6 for all products in the specified category on all pages where they're displayed.

woocommerce product attributes dropdown not appear

i can't select product color or size before add product to cart .
all attributes showing like text not selection
i need to show product attributes dropdown list (options)
i try :
// Remove additional information tab
add_filter( 'woocommerce_product_tabs', 'remove_additional_information_tab', 100, 1 );
function remove_additional_information_tab( $tabs ) {
unset($tabs['additional_information']);
return $tabs;
}
enter image description here
Once you’ve created attributes you’ll need to use those to create variations on your product. I assume what you’re saying is that you click on an attribute and it then takes you to a page showing you any product that is using that attribute.
once your attributes are added to the product follow the rest of this doc to get variations created. Then you’ll have drop down options for those variations on your product.

Woocommerce is it possible to disable quantity field on cart page, for some product?

Basically, I finished building custom plugin for my client.
the only thing after products added to cart, before the checkout.
user able to change the quantity of the products, is it possible to display the selected quantity, but disabled the options to read only so client will able to see the quantity in cart page that he selected but can't change it?
and to apply this only to products that I used with my plugin either product ids or better category id because all the products there.
other product display and able to change quantity regular
by the way its regular products not virtual and not Sold Individually i need to find a way to limit clients to change quantity for some products only in cart page!, and not in product page.
I really appreciate any help.
As mentioned in the comment, you can use the woocommerce_cart_item_quantity filter for that. So that might look something like this:
function 668763_change_quantity_input( $product_quantity, $cart_item_key, $cart_item ) {
$product_id = $cart_item['product_id'];
// whatever logic you want to determine whether or not to alter the input
if ( $your_condition ) {
return '<h3>' . $item['quantity'] . '</h3>';
}
return $product_quantity;
}
add_filter( 'woocommerce_cart_item_quantity', '668763_change_quantity_input', 10, 3);
This would be just a simple example to replace the input with a h3 element containing the quantity. It can easily be adjust to alter the quantity input element to your liking.

Resources