I created an ecommerce using the plugin woocommerce. I am selling only a subscription so the "/cart/" page is useless. I'm trying to get rid of it so that when my customer click on "Add to cart" button, he ends up on the checkout page.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
@RemiCorson posted this brief but beneficial tutorial:
http://www.remicorson.com/woocommerce-skip-product-cart-pages/
He mentions the same filter as @Ewout above,
but one line of code stands out and is of super value for me for my current woocommerce project:
There is a direct link that a user can use to automatically bypass the product page. http://your-site.com/?add-to-cart=37
'37' will be replaced by your product ID.
This was useful for me to eliminate unnecessary steps and take users directly to checkout from the home page and other non-woocommerce pages/posts.
you can use a filter in functions.php:
it doesn't seem to work with ajax, but it works from the single product pages, which I think is what you use
On the latest versions of WooCommerce (>= 2.1) the function can be simplified as: