Posts

how to set up woocommerce store

Learn how to set up Woocommerce Store in less than 10 Minutes

how to set up woocommerce store

Image: Woocommerce

 

WooCommerce is a big thing not in WordPress, but in the online world. You can make a store with ease. Let’s say an online store within 30 minutes.

The things you need [must-need]

  1. Woocommerce compatible themes
  2. Install WooCommerce plugins
  3. Your products
  4. Payment gateway

Most important thing is Woocommerce compatible themes. In case, your theme is not supporting woocommerce. Then the site looks will be very awkward.  Read here to learn how to make a theme that supports woocommerce.

Here are few steps to make your first awesome online store that sells flawlessly.

Install WooCommerce Plugin:

The first task is to install the WooCommerce plugin. Install it directly from WordPress Plugins repo or from your computer.

Now, activate it.

Configure WooCommerce Store:

Right after the activation, you will be automatically redirected to a setup page.  It’s called Woocommerce setup wizard.

WooCommerce Setup Wizard

 

Set it up giving all the information it wants. You will need to put the info about shop location, where to ship, payment gateway etc.  They are pretty easy to set it up. Make sure you are providing right information otherwise your sale can not be processed perfectly.

Create your first woocommerce product:

To add your first product, go to Dashboard > Products > Add products

Then follow the screenshot for the better concept.

 

how to add product in woocommerce

In price box, you can set up SALE price for a product.

You can control the inventory in inventory tabs.

Also, you can add products size, shipping class or methods in shipping tabs.

If the product is a virtual product like freelancing or a downloadable product like software, you can select those select box above.

In product data dropdown option, you can select other product types. Variable product for various product option, color, size etc., external products for affiliate links. Also, you can add grouped product.

Well, after giving all the info, now publish your first product.

Conclusion:

Now it’s time to test the product. See how it works.

Go to the product link, click on the “add to cart” button for the shopping.

Now go to the checkout page to buy.

These procedures are for the test. Just to make sure the store is working or not.

Caution: if you set up Paypal for the payment gateway, make sure you are using in Sandbox mode while testing. 

Make themes woocommerce compatible

How to make themes woocommerce compatible?

Want to make themes woocommerce compatible? When you build WordPress themes from the scratch, generally WooCommerce support is not integrated. To integrate the Woocommerce function, you need to make some tweaks in your themes files. First, duplicate your page.php in themes. Rename it to woocommerce.php . Then open and remove the WordPress post/page loop by woocommerce loop. Probably your page.php codes are like…


<?php
 while ( have_posts() ) : the_post(); ?>
 <h2><?php the_title(); ?> </h2> <?php
 the_content();

 endwhile; // End of the loop.
 ?>

should be replaced by


<?php woocommerce_content(); ?>

If you see this technique is not working, then open Woocommerce plugins file, copy “templates” folder to your themes. Rename it to “woocommerce”.  Now your need to add CSS class manually to woocommerce defaults files. Just for an example, to compatible single products, open the folder single-products, now add your CSS class to  meta.php , price.php and others to make it as you wish.

It’d be better if you create woocommerce theme from scratch. Just make a blueprint before starting. Otherwise, this post may help you. If you need further help or want to make Woocommerce website, just contact here.

extra stock option in woocommerce

Adding extra stock option in Woocommerce

extra stock option in woocommerce

extra stock option in woocommerce

When you need to add an extra stock option in woocommerce i.e. “request to buy” “on request available” etc.  then simply you need to make a tweak. just add this code in functions.php you are done. simple!

/*adding stock option*/

function add_custom_stock_type() {
    ?>
    <script type="text/javascript">
    jQuery(function(){
        jQuery('._stock_status_field').not('.custom-stock-status').remove();
    });
    </script>
    <?php   
    woocommerce_wp_select( array( 'id' => '_stock_status', 'wrapper_class' => 'hide_if_variable custom-stock-status', 'label' => __( 'Stock status', 'woocommerce' ), 'options' => array(
        'instock' => __( 'In stock', 'woocommerce' ),
        'outofstock' => __( 'Out of stock', 'woocommerce' ),
        'onrequest' => __( 'Available to Order', 'woocommerce' ), // The new option !!!
    ), 'desc_tip' => true, 'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ) ) );
}
add_action('woocommerce_product_options_stock_status', 'add_custom_stock_type');

function save_custom_stock_status( $product_id ) {
    update_post_meta( $product_id, '_stock_status', wc_clean( $_POST['_stock_status'] ) );
}
add_action('woocommerce_process_product_meta', 'save_custom_stock_status',99,1);

function woocommerce_get_custom_availability( $data, $product ) {
    switch( $product->stock_status ) {
        case 'instock':
            $data = array( 'availability' => __( 'In stock', 'woocommerce' ), 'class' => 'in-stock' );
        break;
        case 'outofstock':
            $data = array( 'availability' => __( 'Out of stock', 'woocommerce' ), 'class' => 'out-of-stock' );
        break;
        case 'onrequest':
            $data = array( 'availability' => __( 'Available to Order', 'woocommerce' ), 'class' => 'on-request' );
        break;
    }
    return $data;
}
add_action('woocommerce_get_availability', 'woocommerce_get_custom_availability', 10, 2);

Please note: It only works on simple products, not on variable products.

Update: this code is not working with latest Woocommerce. Please use this plugin.