Sometimes it is good to store form data in session – for example when working with filters, when you want to save last filters state when user gets back to page. But if your form has Entity type in choice field, you will see error like:
“Entity of type XXX passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?”
How to deal with this? Read below.Continue reading

This may seem trivial, but in fact about 2 months ago some clever guys made changes in brew repository, so doing just:
brew install php71-intl
will show you error with message that such recipe doesn’t exists. Also XAMPP comes without intl extension so is there any working solution which does not require full and manual php compilation?

Fortunately, there is. There is temporary fix in another brew repo, so all you have to do is:
brew tap kyslik/homebrew-php
brew install kyslik/php/php71-intl

And this works. Really. Enjoy.

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:

$args = array(
	'post_type' => 'product_variation',
	'posts_per_page' => -1,
	'meta_query' => array(
			'key' => '_stock_status',
			'value' => 'outofstock',
			'key' => '_stock',
			'value' => '0',
			'compare' => '>',
			'type' => 'NUMERIC'
$products = new WP_Query($args);

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:

function get_woocommerce_checkout_polylang()
    return pll_get_post(get_option('woocommerce_checkout_page_id' ) );
add_filter('woocommerce_get_checkout_page_id', "get_woocommerce_checkout_polylang");

function get_woocommerce_shop_polylang()
    return pll_get_post(get_option('woocommerce_shop_page_id' ) );
add_filter('woocommerce_get_shop_page_id', "get_woocommerce_shop_polylang");

function get_woocommerce_cart_polylang()
    return pll_get_post(get_option('woocommerce_cart_page_id' ) );
add_filter('woocommerce_cart_page_id', "get_woocommerce_cart_polylang");

function get_woocommerce_pay_polylang()
    return pll_get_post(get_option('woocommerce_pay_page_id' ) );
add_filter('woocommerce_pay_page_id', "get_woocommerce_pay_polylang");

function get_woocommerce_thanks_polylang()
    return pll_get_post(get_option('woocommerce_thanks_page_id' ) );
add_filter('woocommerce_thanks_page_id', "get_woocommerce_thanks_polylang");

function get_woocommerce_myaccount_polylang()
    return pll_get_post(get_option('woocommerce_myaccount_page_id' ) );
add_filter('woocommerce_myaccount_page_id', "get_woocommerce_myaccount_polylang");

function get_woocommerce_edit_address_polylang()
    return pll_get_post(get_option('woocommerce_edit_address_page_id' ) );
add_filter('woocommerce_edit_address_page_id', "get_woocommerce_edit_address_polylang");

function get_woocommerce_view_order_polylang()
    return pll_get_post(get_option('woocommerce_view_order_page_id' ) );
add_filter('woocommerce_view_order_page_id', "get_woocommerce_view_order_polylang");

function get_woocommerce_terms_polylang()
    return pll_get_post(get_option('woocommerce_terms_page_id' ) );
add_filter('woocommerce_terms_page_id', "get_woocommerce_terms_polylang");

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.

Well, the easiest way is to use

composer.phar update

but if you don’t want to update all bundles and waste an hour of your time, you can use:

php vendor\sensio\distribution-bundle\Sensio\Bundle\DistributionBundle\Resources\bin\build_bootstrap.php <app>

where <app> is placeholder for you app dir, like “app/frontend” or “app/backend”
in case you don’t have build_bootstrap.php on path above (it works for Symfony 2.7.x) just search for it inside vendor\sensio\distribution-bundle\Sensio\Bundle\DistributionBundle

Since this information is not easy to find, I want to share it with you. Valid WSSE security header should look like this:

 <wsse:Security xmlns:wsse="" soapenv:mustUnderstand="1">

this way you can execute request requiring this header.

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 “”. Then look below, in “Product permalink base” section choose “Shop base” – it will look like “”. Click “Save CHanges” and below you should see new box with .htaccess settings like:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

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