If you do not have much experience as a web designer, you will realize that not everything can be done with plugin. Each CMS has its own specific use: Prestashop and Magento or OS Commerce are for online stores, WordPress or Joomla for content management and corporate websites or blogs, Dolibarr for ERP, and a lot of other products.
The problem is when you want to have a combination of both. For example: An online store with a blog. The normal in these cases is to create an online store in Prestashop or Magento (read the post that will help you choose between the two), and in a directory of the store install WordPress for a blog that you can control.
WordPress has plugins like woocommerce, eshop and others that help you create an online store on a CMS on this platform. The problem comes when you want to implement a catalog just like an online store, but without the shopping cart.
Well, we will describe step by step how to integrate woocommerce in an online store and also disable the shopping cart to avoid problems.
We start with a WordPress theme and the Woocommerce plugin installed.
Woocommerce Integration
The first thing we have to do is to integrate the plugin properly in our theme, since in most cases the right bar is always below the woocommerce content. To do this we do the following:
- In the directory …./wp-content/themes /tutema/… duplicate page.php and rename it to woocommerce.php.
- We must find the Loop that we want to modify. It begins with :
<?php if ( have_posts() ) :
And usually ends with
- We must replace it with this: <?php woocommerce_content(); ?>
We are done with the integration. Now we need to remove the add to cart button to avoid problems with false purchases and so on.
Removing the add to cart button
To do this we must edit the functions.php file of our Theme. As clarification and help, those who use Mac have Coda to modify code and connect by ftp to edit the files in real time. Those who work with PC PSPad is a good tool, as well as UltraEdit, but if I have to choose between one and the other I’ll choose PSPad.
- Go to …/wp-content/themes/your-theme/functions.php
- Go to the second to last line of code between <?php } and ?> and add the following:
//code to disable add to cart button in product listing…
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’ );
// Code to disable add to cart button on product page products…
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );
This disables the add to cart button, both in the product listings and on the individual product pages. Now we just have to disable the pages that woocommerce has created for us automatically as the cart, My account, checkout, etc … But we can not do it anyway, because if at any given time we want to use the catalog to sell online and activate it again we can do it.
Disable woocommerce pages
To do this we will use the plugin Exclude Pages it adds a field on the right to exclude or include the page. We enter from the BackOffice to the automatic pages of the plugin store and deactivate the checkbox Exlude Pages. This way you will not be able to access in any way to the store and you will not be able to make any purchase.
Re-enable everything.
If after a while, we want to enable the catalog to sell those products online and Woocommerce is a very complete plugin to do so, we must re-enable both the “Add to Cart” button and the automatic pages.
What is the Difference Between POSTS and PAGES in WORDPRESS?
For the latter we’ll need to select the Exlulde Pages checkbox on each automatic page, while to display the add to cart button we need to disable the code inserted above. We simply add // in front of remove_action and it will look like this:
//Code to disable the add to cart button in the product list…
//remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’ );
// Code to disable add to cart button on product page products…
//remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );
This way we can have a fully integrated catalog with our CMS or corporate website, without the need to have an online store.
Leave a Reply