WooCommerce

From IT Wiki
Jump to navigation Jump to search


WooCommerce is an open source WordPress E-commerce store. It is developed and supported by WooThemes.

Code

Disable Payment Method for Specific Category

Add the following to child theme's functions.php:

/**
 * @snippet       Disable Payment Method for Specific Category
 * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @sourcecode    https://businessbloomer.com/?p=19892
 * @author        Rodolfo Melogli
 * @compatible    WC 3.5.7
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_filter( 'woocommerce_available_payment_gateways', 'bbloomer_unset_gateway_by_category' );
 
function bbloomer_unset_gateway_by_category( $available_gateways ) {
$unset = false;
$category_ids = array( 483 );

foreach ( WC()->cart->get_cart_contents() as $key => $values ) {
    $terms = get_the_terms( $values['product_id'], 'product_cat' );    
    foreach ( $terms as $term ) {        
        if ( in_array( $term->term_id, $category_ids ) ) {
            $unset = true;
            break;
        }
    }
}
    if ( $unset == true ) unset( $available_gateways['bluepay'] );
    return $available_gateways;
}

Plugins

WordPress supports the use of plugins to add functionality. WooCommerce is a plugin for WordPress. In addition, WordPress plugins can also improve and extend WooCommerce.

Shipping

The following list of plugins claim to improve the shipping options for WooCommerce. Note that they are not recommended unless otherwise stated.

  • AWD Weight/Country Shipping for WooCommerce - Calculate shipping charges based on cart weight and country of delivery. You can group countries that share same delivery costs (e.g. USA and Canada, European Union countries etc) or set cost on per-country basis.
Note: This plugin is currently [2014-02-21] incompatible with the latest version of WooCommerce. A work-around has been posted here, but is subject to problems if WooCommerce changes that file.
A better solution appears to be here.
  • Table Rate Shipping for WooCommerce - The WooCommerce Table Rate Shipping plugin has the ability to add multiple rates for a given customer based on a variety of conditions set by admin. These can include shipping destination, cart subtotal, item shipping class, price, weight, and so much more. Regular License $21.
  • Weight based shipping for WooCommerce - Simple weight based shipping for WooCommerce. It offers a universal price-per-gram shipping model. It may be limited in setting different rates across international zones.
  • WooCommerce - APG Weight and Postcode/State/Country Shipping - This plugin has been noted as a replacement for AWD Weight/Country Shipping for WooCommerce (above), since that one is currently now working. Calculate shipping based on weight, size and zip code, province (state) and / or customer's country.
  • Woocommerce Product Shippings per Product - This plugin for woocommerce lets you select the available shippings for each individual product. You can select for eacht individual product the shipping that will be used by checkout. This version is limited to set different shipping for 10 products. For a fee you can get the full version with no limitation.

Recommended

  • oik Weight/Country Shipping for WooCommerce - Calculate shipping charges based on cart weight and country of delivery. You can group countries that share same delivery costs (e.g. USA and Canada, European Union countries etc) or set cost on per-country basis. Note: This plugin replaces AWD Weight/Country Shipping for WooCommerce (above).