Tag: Development

  • WooCommerce the best solution for eCommerce in 2020

    WooCommerce the best solution for eCommerce in 2020

    In the past month the world has taken a turn due to Covid-19 and the actions taken to fight this pandemic.

    With social isolation, quarantine and all the brick and mortar stores with their doors closed we’ve seen a bigger rise in e-commerce sales across the world. 

    What has been a steady trend already is growing quicker than before escalating even more than 100% in the past 30 days in several categories (source: Aciworldwide)

    Everyday more and more consumers are using online stores in their day to day shopping, a trend that is probably not going to go away any time soon.

    Following this trend, shop owners from all types of business have been hunting for the best solution for their online stores.

    Being a WordPress and WooCommerce expert, I am a little biased :), but let me tell you why I think WooCommerce is the best solution for e-commerce in 2020.

    1. Low startup cost, free and open-source just like WordPress
    2. User Friendly, created with the user in mind, every configuration aims to be simple and easy to use
    3. All basic features are free, unlimited products, unlimited orders, payment gateway plugins, basic reporting are all free features you’ll find in WooCommerce
    4. Huge user base, allowing you to easily find lots of tutorials and guides online
    5. Easy to customize, there are hundreds of plugins on both free and paid repositories
    6. Extensible and open source, if you can’t find a plugin to fit your needs or you need some custom changes, you can hire a developer to create a custom solution

    For instructions in how to setup your WooCommerce shop, you can follow the official documentation in https://woocommerce.com/posts/how-to-set-up-a-new-woocommerce-store/

    Don’t know how to solve a specific issue or you’re needing a custom feature built?

    Schedule a free consultation meeting with me here.

  • WooCommerce and WooCommerce Subscriptions – Automatically set order status to completed

    WooCommerce and WooCommerce Subscriptions – Automatically set order status to completed

    This post is an update onWooCommerce – Automatically set order status after payment is received

    WooCommerce is a great option to sell all type of goods, being it virtual or physical products you’ll quickly add them to your store and start selling to your visitors.

    By default when WooCommerce system processes a payment it’ll set an order with only virtual and downloadable products to completed but sometimes this isn’t enough for your store.

    In this case, the store sells physical products and subscriptions, that can be a physical product sent by mail each month or a virtual product that gives you access to restricted areas of the website, because of that we need to change WooCommerce default behavior and automatically set our virtual subscriptions as completed orders, after the payment is complete.

    For doing this we’re going to use a hook “woocommerce_order_item_needs_processing” and check if the products on the order are only virtual and subscriptions.

    /**
     * Set Orders from Subscriptions marked as Virtual Products Completed Automatically.
     *
     * @param  boolean $virtual_downloadable_item If item is virtual and downloadable.
     * @param  Object  $_product                  Product Object.
     * @param  int     $product_id                Product ID.
     * @return Boolean                            Should not be set to processing.
     */
    function rfvc_set_virtual_subscriptions_completed( $virtual_downloadable_item, $_product, $product_id ) {
    
    	if ( $_product->is_virtual() && is_a( $_product, 'WC_Product_Subscription' ) ) {
    		$virtual_downloadable_item = true;
    	}
    
    	return $virtual_downloadable_item;
    }
    add_filter( 'woocommerce_order_item_needs_processing', 'rfvc_set_virtual_subscriptions_completed', 10, 3 );
    
    

    You can also use this code to change the order status in virtual products, without them being subscriptions, removing the check for a subscription product object && is_a( $_product, 'WC_Product_Subscription' )

  • When WordPress caching system makes things slower

    When WordPress caching system makes things slower

    Last week has launch time for my/Samsys latest and last plugin, an internal messaging system for WordPress websites, developed to work together a custom WordPress product for Pre-schools.

    The plugin allows registered users to exchange messages between them using a front-end interface ( non-admin users) and a back-end interface on the wp-admin (users with administrative access).

    Everything was going smoothly until I started testing on a live website with more than 600 registered users. The front-end ran smoothly but the back-end became painfully slow with over 15 seconds of load time.

    After some investigation, I was able to pinpoint the “problem”, multiple databases calls for “update_meta_cache” each call only took milliseconds to process but there were thousands of them and it was slowing down the back-end performance.

    What’s “update_meta_cache” ?

    As it’s name suggests, this functions updates metadata cache on a specified object and runs  everytime you fetch metada from the database.

    “update_meta_cache” is very handy on the front-end where exists a caching mechanism in place but in the back-end, no cache is active and it slowed down the plugin performance painfully. The solution has relatively simple, instead of fetching the users every time I needed them listed I created an object with all the needed user data, saved it using Transients API, and every time a new user it’s added to the website the object it’s re-created with the new data.