How to create adobe illustrator symbols from objects

Sometimes you have a lot of drawings that you want to use as symbols.

One way to create your symbols in illustrator for later re-use is to manually adding each object to your symbol library.


Use this script to do it automatically

var currentDoc = activeDocument;
var groupItemsList = currentDoc.groupItems;
var vCounter =0;

// Add all object that are grouped together as a new symbol
// If one needs to add single paths ( ungroup items) then add another loop for currrentDoc.pathItems.

if (groupItemsList.length > 0) {
for (i = 0; i < groupItemsList.length; i++) {
vCounter = vCounter +1 ;

alert ( vCounter + ” Symbols created”);
else {
alert(“Your document does not have any valid objects”);

How to capitalize first letter in MySQL

Unlike other (some) DB engines, MySQL does not have a built-in function for capitalizing (capitalize first letter) but the solution can be simple.

option_name ‘original’
CONCAT(UCASE(LEFT(option_name, 1)), LCASE(SUBSTRING(option_name, 2))) Capitalized
from wp_options where LEFT(option_name, 1) <> ‘_’

Add amazon enterprise Icons to adobe illustrator library

Using adobe illustrator symbols to quickly add pre-existing symbols to your diagrams is a big time saver.

Amazon provides icons for architecture drawing, although the icons provided from these vendors in vector format, each comes as individual file . to simplify your drawings I created a symbol library for your use.

Follow these steps to permanently add amazon (AWS) symbols to your Illustrator workspace.

  1. Download a copy of the symbols library from here
  2. Copy the file to your adobe illustrator symbols directory : \Program Files\Adobe\Adobe Illustrator CC 2017\Presets\en_US\Symbols\

  3. Now from the symbols panel add a reference to your symbols library, it will be showing in the drop down menu.

Amazon icons can be found in here.


How to add a product to a shopping cart programmatically in woocommerce

The problem
Sometimes you need the functionality of a shopping cart without forcing your customer to interact with your web site in the traditional way of a e-commerce.

For example let’s say you have a sample product that you just want automatically added to a shopping cart, so your customers can just click on let say “try product” and then be taken directly to a checkout process. This only applies to woocommerce, however the approach may be similar to other e-commerce toolkits.

This example is a modification from the woocommerce documentation.


# Requirement detail


A Product x is automatically added to a shopping cart when a non-logged in customer visits your site. This forces a visitor to register when they do checkout


Remove a product if the users is logged in


The site “try now” button is a link to “check out”, where the web site collects customers billing/shipping information.

These requirements allow a web site to collect customer billing information taking advantage of the built-in woocommerce logic.


  1. Go to your wordpress admin page usually under https://[your-web-site]/wp-admin/

  1. We are going to use the SKU to do a lookup in this case is L3-670115

  1. When your customers visit your site the product is going to be in their shopping cart , ready to checkout

  2. And here is the code, this needs to be visible in your functions.php file. But that you already knew it.
  3. add_action(‘wp_loaded’, ‘add_product_to_cart’);

    function add_product_to_cart()

    if (!is_admin()) {

    $product_id = wc_get_product_id_by_sku(‘L3-670115’);

    $found = false;

    if (is_user_logged_in()) {
    if (sizeof(WC()->cart->get_cart()) > 0) {
    foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
    $_product = $values[‘data’];
    if ($_product->id == $product_id)
    } else {
    if (sizeof(WC()->cart->get_cart()) > 0) {
    foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
    $_product = $values[‘data’];
    if ($_product->id == $product_id)
    $found = true;
    // if product not found, add it
    if (!$found)
    } else {
    // if no products in cart, add it

    Hope you enjoy.