Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My snippets which can be helpful to create Polylang & WooCommerce Integration Plugin #17

Open
rootkowsky opened this issue Jan 26, 2015 · 1 comment

Comments

@rootkowsky
Copy link

Hi,
I've discovered this plugin yesterday. Amazing work. I spend few hours to translate own shop with Polylang plugin, because there were problems with shop (archive product) routing. Your plugin of course solves it. I want to become helpful and place here my snippets which can be usefull to create Polylang & WooCommerce Integration Plugin.

/* WOOCOMMERCE AND POLYLANG INTEGRATION */

/* Woocommerce Login Redirect */
add_filter('woocommerce_login_redirect', 'wi_login_redirect');
function wi_login_redirect( $redirect_to ) {
    if(function_exists('pll_get_post')){
        return get_permalink(pll_get_post(url_to_postid( $redirect_to )));
    }
    return $redirect_to;
}

/* Woocommerce PolyLang Proper Woocommerce Pages Routing */
add_filter('woocommerce_get_shop_page_id','pll_woocommerce_get_page_id');
add_filter('woocommerce_get_cart_page_id','pll_woocommerce_get_page_id');
add_filter('woocommerce_get_checkout_page_id','pll_woocommerce_get_page_id');
add_filter('woocommerce_get_terms_page_id','pll_woocommerce_get_page_id');
add_filter('woocommerce_get_myaccount_page_id','pll_woocommerce_get_page_id');
function pll_woocommerce_get_page_id($id){
    if(function_exists('pll_get_post')){
        return pll_get_post($id);
    }
    return $id;
}
@optiguy
Copy link

optiguy commented Mar 3, 2015

Thanks for the snippet.
I only had two of the pages in my own plugin, so this helped me a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants