Sometimes, especially if you are using custom plugins to import stock data, you may find products with some stock value (greater then 0) but with stock flag set to “out of stock”. How to find them? Using WP_Query of course:

Notice ‘post_type’ => ‘product_variation’ – if you are not using variations, just change it to ‘product’.

This can be really frustrating, you wanted your woocommerce shop running multilingual, but from cart page “Checkout” button leads to default language version? Solution is very simple, but not elegant – so far did not found another solution. First step is to create all woocommerce pages in every language you need, this is very simple but can take some time. Then, in your child theme (remember not to make any modifications to theme you are using!), in functions.php add such code:

All those functions are using same pll_get_post from Polylang plugin, to translate your default page ID you set in Woocommerce/Settings/Checkout/Checkout Pages to their translated version. Hope you will find it useful.

This can be frustrating when you are new to wordpres and/or woocommerce. You just created your first product, and got 404 when trying to see it. Fortunately solution is quite simple. In backend panel go to “Settings”, then “Permalinks”. In “Common settings” section make sure “Post Name” is selected, if not, choose it – it will look like “http://newbl.blastar.biz/sample-post/”. Then look below, in “Product permalink base” section choose “Shop base” – it will look like “http://newbl.blastar.biz/shop/sample-product/”. Click “Save CHanges” and below you should see new box with .htaccess settings like:

Just copy it and paste to your .htaccess. All links should work now!

It is a bit different then method showed in previous post – this time its not transactional email sent at demand, but we will catch event fired after invoice is generated. So (I suppose you have your module already) in etc/config.xml add:

Then create your class at app/code/local/YourVendor/YourModule/Model/Observer.php (or use existing one) and add new method:

And invoice will be attached to email defined at:

Zrzut ekranu 2015-01-14 o 19.12.17

If you are using MAMP and trying to execute doctrine:schema:create or anything db related you may encounter that error, solution is simple – you need to create symlink to mysql.sock:

Such error happens in 1.7.x branch (I saw it in 1.7.2), when entering database parameters you’re seeing “PHP Extensions “0” must be loaded” instead of next step. This is internal Magento bug, you can correct it by finding file app/code/core/Mage/Install/etc/config.xml  and replacing:

with:

running:

command can cause such sample output:

solution is simple, just put:

in terminal, push enter and rerun phpize after brew finishes hiw work

Well, first rule – you should not do this. But if there is good reason, consider using such query for searching in index-based arrays:

In case you have assoc array serialized you can use:

Of course it won’t be very fast but in small tables should be enough

Yes, it can be really painfull – MSSQL (at least instance I’m using) is saving date in format “d/m/Y H:i:s” but in every part of code I had “Y-m-d H:i:s”. So what now – rewrite everything? Nope, there is ugly but working way to do it, after ADODb object is created and initialized put:

and that’s it – all dates will be internally converted to given format, so here is full example of config: