Woocommerce hides cart_totals when using cart and checkout on same page - wordpress

On my cart page I updated it to include the two short codes:
[woocommerce_cart] – shows the cart page
[woocommerce_checkout] – shows the checkout page
By default the cart page is only populated with [woocommerce_cart] and it will show the cart, coupon code area, and cart totals. When I add the [woocommerce_checkout] it removes the cart totals box.
Does anyone know a work around for this? Or know of this problem?

WooCommerce hides the cart totals by default when the checkout is also present on the same page. This is because it gives duplicate information that might be confusing for your customer, since the checkout also displays subtotal, total and shipping information.
You could bring the cart totals back with a snippet like this:
add_action( 'woocommerce_after_cart_table', 'woocommerce_show_cart_totals', 10 );
function woocommerce_show_cart_totals() {
wc_get_template( 'cart/cart-totals.php' );
}
But changing the shipping method for instance wouldn't work as the shipping method option of the checkout would overwrite again what you have selected in the cart totals.

Related

Woocommerce Cart Items not showing

When I add products to the cart they do not appear, only the total price and final purchase appear, configuration is ok.
Someone said to me that the problem is related to dynamic change on the cart page
Cart page error

how to prevent same product adding multiple times to cart when I want my visitor to directly go to checkout

Let say someone decides to buy my product and click on the buy now option and reached my checkout page. But for some reason he/she didn't buy it.
But after sometime he/she made his mind to purchase the product but when they click on buy know button the product price get doubles because the product is added a second time in the cart.
As i am not giving access to the cart page to my visitor so they can't modify there cart.
Is there anyway with which I can prevent the same product adding a second time in cart.
I don't want the min maximum plugin because it doesn't prevent from adding same product multiple time. It just shows a notification that the max amount is 1.
I just don't want the same product to be addded twice in the cart no matter what.
I tried this code:
add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' );
function woo_custom_add_to_cart( $cart_item_data ) {
global $woocommerce;
$woocommerce->cart->empty_cart();
// Do nothing with the data and return
return $cart_item_data;
}
But after adding it I am not able to add a second product into my cart.
As I have added a order bump in my checkout page but when i tried to add it it replaced the main product.
You can force a single purchase of a given product from Edit Product > Product Data > Inventory > Sold Individually
No code needed

Display tax in woocommerce cart widget product same like checkout page

I want to display tax on woocommerce shop page side bar cart widget product list same like checkout page.
Current checkout page -> http://nimb.ws/kbn6mL
Shop page side bar woocommerce cart widget -> http://nimb.ws/JVfMtH
So if anyone knows this solution then please help me.
Please check your woocomerce tax setting tab that you have selected Display tax totals as single total then it will show you on cart page.
https://s.nimbus.everhelper.me/share/1178235/8f9h105gwa5mz3cle7vv
As you can see Woocommerce itself displays only cart subtotal on cart widget or mini cart, there will be no setting for this to enable/disable for displaying not only tax but shipping as well. So if you want to add tax and shipping related data on mini cart widget then you can add your functionality on this hook 'woocommerce_widget_shopping_cart_before_buttons' by fetching data from the WC->cart

WooCommerce - Remove cart?

I want to take a straight payment for the one item, not have multiple items and cart functionality.
This is what I have so far:
User views product, presses buy and goes to checkout (via a straight checkout link), problem is here is that at the top of the checkout page it says “XXXX product has been added to cart – View Cart”. I don’t want this cart part there it should just go straight to the checkout and take the payment.
Another problem is if they go back through my funnel it adds a second item into the cart. I only want them to be able to purchase a quantity of 1 so I don't need any cart functionality just a straight checkout.
How can this be done?
Thanks
Try the following code redirect users to Checkout Page after add to cart.
/**
* Redirect users to Checkout Page after add to cart.
*/
function my_custom_add_to_cart_redirect( $url ) {
$url = WC()->cart->get_checkout_url();
return $url;
}
add_filter( 'woocommerce_add_to_cart_redirect', 'my_custom_add_to_cart_redirect' );
You can also try this plugin https://wordpress.org/plugins/woocommerce-direct-checkout/

Drupal Commerce Ajax cart with added fields

Sorry for the really bad title but wasn't sure how to describe my problem in 10 words.
I have drupal commerce and have made a view that displays the cart contents on top of the checkout page.
Quantity is a text field so it is editable and I have an update button. Unfortunately when I press the update button, naturally the whole checkout page tries to submit. Is there a way to intercept the update button and just refresh the cart with ajax?
Moreover, if I can do that, I want a number of text fields (as many as the quantity number entered) to appear underneath the cart so the user can enter different values on each of them (each referring to the products about to be bought).
Drupal Commerce Cart does this - sort of.. http://drupal.org/project/dc_cart_ajax
It works fine on the cart page, though I too am trying to combine these pages to cut down on the 'checkout steps'. Though it is the same view as the /cart page and I get an ajax refresh indicator it doesn't actually update the cart on the checkout page.
There is a issue related to that, you can subscribe: http://drupal.org/node/1443470
You can disable the Shopping cart contents using the checkout settings. Modify the Shopping Cart View to add a block display and add modify the contextual filter by providing default value using PHP:
if (arg(0) == 'checkout') return arg(1);
else return null;
Add the new Shopping cart block dispplay only on the checkout page and here you go.

Resources