Skip Navigation

[Resolved] Go directly checking out with woocommerce

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 6 replies, has 2 voices.

Last updated by Christian Cox 7 years ago.

Assisted by: Christian Cox.

Author
Posts
#587026
QQ图片20171107014430.png

Hello, I just want to continue this closed ticket which has been thought resolved,https://toolset.com/forums/topic/how-to-build-a-pricing-table-with-woocommerce-by-toolset/ I just wanna build a pricing table for few simply products. so I did following steps.

1, Using title+ price + product briefs + {!{wpv-woo-buy-or-select add_to_cart_text="Pay now"}!} to set up a view, note, the add_to_cart is just using for products listing page,

2, put that shortcode of View on the page,

3. put this piece of code to function.php hidden link

add_filter('add_to_cart_redirect', 'themeprefix_add_to_cart_redirect');
function themeprefix_add_to_cart_redirect() {
 global $woocommerce;
 $checkout_url = $woocommerce->cart->get_checkout_url();
 return $checkout_url;
}

4. As per other steps that webpage says, I also set up product setting of woocommerce,

but there are two issues appeared.

1. after clicking "Buy now", "view cart" shows up next to button, only if clicking "view cart", the page goes to checkout page, can it go to checkout page just one click?

2. the most important thing is that shopping cart still gets +1, if clicking "pay now", an ideal solution should be automatically clearing shopping cart while each new clicking triggered I guess.

I think the pricing table of your site is very good, maybe you can share this to me if possible 🙂 https://toolset.com/buy/

Best regards

#587307

Hi, our "Buy" page uses CRED Commerce. When you use a CRED Commerce form to add an item into the User's cart, it can be set to redirect to the Checkout page immediately. It can also be set to remove any other items previously added to the cart. In your case, you will remove all the inputs from the form except the submit button, which you could configure to say "Add to Cart" or something similar. Is CRED Commerce something you have considered? More info here:
https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/

#587351

Prior to opening this ticket, I had tried to user Cred commerce. it seems no bad, but got two things

1、I have to add 3 or 4 cred form on the shop page, it takes total 4~5 seconds. 1.5second/per form. and no way to cache, I have consulted with the team of WP Rocket, they said caching plugin is not able to cache woocommerce ajax etc.

2. After clicking the "Pay now", the page spends too long for transferring onto checkout page than the page just using woocommerce and "Add to cart"

3.https://toolset.com/=?add-to-cart=474997&buy_now=1, https://toolset.com/=?add-to-cart=474998&buy_now=1,
https://toolset.com/=?add-to-cart=475000&buy_now=1, your Buy Now page seems using add to cart and redirect to checkout page. above are links of purchase button of three products

Thanks!

#587586

If CRED Commerce isn't acceptable, you'll need to use custom code that modifies the add-to-cart redirect. That's not something I can help you with, since it's not directly related to Toolset APIs. There is a WooCommerce hook that might help you: "woocommerce_add_to_cart_redirect":
https://docs.woocommerce.com/wc-apidocs/hook-docs.html

And a WooCommerce method for clearing the cart:
https://docs.woocommerce.com/wc-apidocs/source-class-WC_Cart.html#291-307

I recommend contacting WooCommerce support if you need help with their APIs:
https://woocommerce.com/my-account/tickets/

#588326

Hi Christian, Thank you so much for your help, I am so excited now, I have got a way to perfectly solve this problem, directly checking out, clearing shopping cart by each clicking and redirecting shopping cart to checkout page. I just want to keep this ticket, as soon as I have spare time, I will share the solutions. 😀 😀 😀 !

#588329

Oh, keep this ticket! 😀

#588333

Sure, I'll mark the ticket as pending an update from you. Thanks!