Remove Action for Review Order Title (Your order) in WooCommerce - woocommerce

I am trying to remove the title "Your order" from the WooCommerce checkout without editing the template. Here's what I've tried, without success.
add_action( 'woocommerce_checkout_before_order_review_heading', 'youroder_remove_title');
function yourorder_remove_title() {
echo '';
}
remove_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_before_order_review_heading', 10 );
Can anyone help?

add this to your function.php to remove ordor summary from checkout
remove_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );

Related

Add a shortcode above the WooCommerce product short description

I am trying to add a shortcode to all my woocommerce single product pages. I want the shortcode to appear above the short description.
I have found this code and added it to functions.php, but I can see that it adds the shortcode below the short description (and above the add to cart button).
add_filter('woocommerce_short_description','ts_add_text_short_descr');
function ts_add_text_short_descr($description){
$text = do_shortcode('[my-shortcode]');
return $description.$text;
}
I would be very gratefull for some help :)
function customShortcodeBeforeShortDescription( $post_excerpt )
{
echo do_shortcode('[wpqr-code]');
}
add_filter('woocommerce_short_description','customShortcodeBeforeShortDescription', 10, 1);
You can use the woocommerce_single_product_summary action hook. try the below code. The code will go in your active theme functions.php file.
function add_shortcode_before_short_description(){
echo do_shortcode( '[wpqr-code]' );
}
add_action( 'woocommerce_single_product_summary', 'add_shortcode_before_short_description', 15, 1 );
Tested and works

Show custom text block on product page only if a product is out of stock with backorder enabled

i have a wordpress site with woocommerce and flatsome theme. The theme give the possibility to add easily a custom html text before or after the add to cart button.
I would like that the html text show up only for out of stock with backorder enabled products, for single and variables products.
the theme have this code
// Add HTML after Add to Cart button
function flatsome_after_add_to_cart_html(){
echo do_shortcode(get_theme_mod('html_after_add_to_cart'));
}
add_action( 'woocommerce_single_product_summary', 'flatsome_after_add_to_cart_html', 30);
any help is appreciated
You can likely do that with just an additional couple of checks in your function. Before echoing the content - check the $product like this:
function flatsome_after_add_to_cart_html(){
global $product;
if( ! $product->is_in_stock() && $product->backorders_allowed() ){
echo do_shortcode(get_theme_mod('html_after_add_to_cart'));
}
}
add_action( 'woocommerce_single_product_summary', 'flatsome_after_add_to_cart_html', 30);

Woocommerce Product details page remove add to cart and put Email Button

In my woocommerce website for simple products, I need to remove Add to Cart, quantity box and put a Email Button with mail to link. Can anyone please help me how can i do it.
Add This code snippet in active theme function.php file
// For remove Add to cart button
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart');
// add inquiry button into every product
add_action( 'woocommerce_after_shop_loop_item', 'prfx_add_inquiry_button', 10); // catalog page
add_action( 'woocommerce_single_product_summary', 'prfx_add_inquiry_button', 30); // single product page
function prfx_add_inquiry_button() {
$current_product_id = get_the_ID(); // get ID of the current post
$current_product_title = get_the_title(); // get the title of the current post
$product = wc_get_product( $current_product_id ); // get the product object
echo $current_product_title;
echo 'Inquiry';
echo '</a>';
}

Move "Add to Cart" form below product description

I want to move only add to cart form below products description. To explain better:
Found this function, but it moves this at top of product under description. So some part of function is not right. Can someone to help me?
add_action( 'woocommerce_single_product_summary',
'customizing_variable_products', 1 );
function customizing_variable_products() {
global $product;
if( ! $product->is_type( 'variable' ) ) return;
remove_action( 'woocommerce_single_product_summary',
'woocommerce_template_single_add_to_cart', 30 );
add_action( 'woocommerce_single_product_summary',
'woocommerce_template_single_add_to_cart', 15 );
}
You have to copy / paste all the woocommerce templates into your current template folder.
This way, the woocommerce theming isn't gonna take it's own templating but will take the one you pasted instead.
Then, you'll just have to find, where, in the template files where is printed the options, and where is printed the add to cart button. You'll be then able to switch the code sa that it makes what you need.
here is the doc about how overriding templates files.

Remove Add to Cart Button from MyStile Theme in Woocommerce

I have difficulty doing this even after following instructions of how to do it. I don't know if the structure of woocommerce have changed since the below snippet was given.
Below is the code I tried using to remove the Add to cart button in the Homeapage and Shop page.
Mind you, this was pasted in the Theme Functions (functions.php) and I use MyStile Theme.
I was able to remove the Add to Cart button from the single page but not the homepage and shop page.
Code
function remove_loop_button(){
remove_action('woocommerce_before_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);
}
add_action('init', 'remove_loop_button');
Thanks for your help in advance.
You can use following code. Put it in your functions.php:
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
To Remove “Add to Cart” button all you need to do is paste the following lines of code in your functions.php file located inside your theme’s directory.
//remove "Add to Cart" button on product listing page in WooCommerce
add_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_buttons', 1 );
function remove_add_to_cart_buttons() {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
}

Resources