Website Building » WooCommerce » How Do I Skip a Single Product Page in WooCommerce?

How Do I Skip a Single Product Page in WooCommerce?

Last updated on January 18, 2023 @ 7:57 am

It’s no secret that WooCommerce offers a ton of features and customization options. However, sometimes you just want to keep things simple and skip a product page entirely.

Maybe you’re selling digital products or services, and there’s no need to show a product page. Maybe you’re selling affiliate products and don’t want to send your traffic away from your site. Whatever the reason, there is a way to skip the product page in WooCommerce.

If you go to WooCommerce > Settings > Products, you’ll see an option to “Redirect to the cart page after successful addition.” Simply check this box and save your changes. Now, when someone adds a product to their cart, they will be redirected to the cart page instead of the product page.

Of course, this isn’t the only way to skip the product page in WooCommerce. If you’re comfortable with code, you can also add a simple line of code to your functions.php file. Just add this:

PRO TIP: If you are using WooCommerce to sell products on your website, you may occasionally need to skip a single product page. For example, if you have a product that is no longer available, you may want to remove the page from your website. Skipping a product page can be accomplished by following these steps:

1. Log into your WordPress Dashboard and go to WooCommerce > Settings.

2. Click on the Products tab and then select the Display tab.

3. Scroll down to the “Shop Page Display” section and change the “Products per page” value to “0”.

4. Save your changes.

5. Go to the product page that you want to remove and change its status to “Draft”.

6. Save your changes again.

The product page will now be removed from your WooCommerce shop.

function redirect_to_checkout() { 
global $woocommerce; 
$woocommerce->cart->empty_cart(); 
wp_redirect( $woocommerce->cart->get_checkout_url() ); 
exit; 
} 
add_action( 'wp', 'redirect_to_checkout' );

This code will automatically empty the cart and redirect the user to the checkout page when they add a product to their cart. This is useful if you only want to sell one product at a time.

Conclusion:

There are a few different ways that you can skip the product page in WooCommerce.
If you’re selling digital products or services, you can simply redirect users to the cart page after they add a product to their cart. If you’re selling affiliate products, you can use a line of code to automatically empty the cart and redirect users to the checkout page.

Madison Geldart

Madison Geldart

Cloud infrastructure engineer and tech mess solver.