Forum Replies Created

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter mastergraphiks

    (@mastergraphiks)

    Here is the code, might be helpful for others as well.

    add_filter( 'woocommerce_get_checkout_url', 'krokedil_change_checkout_url', 30 );
    function krokedil_change_checkout_url( $checkout_url ) {
    
        // Define your SPECIAL CATEGORY here AND your CUSTOM URL
        $my_cat = 'Cat name'; // or for multiple categories
        // $my_cat = array('Cat name1', 'Cat name2');
        $my_url = 'http://my_custom_url.com/checkout/'; // custom URL
    
        $bool_cat = false;
        if ( sizeof( WC()->cart->cart_contents) > 0 ) {
            foreach ( WC()->cart->get_cart() as $cart_item ) {
                $item = $cart_item['data'];
    
                // =>  Updated a mistake in this line
                if(!empty($item) && !$cat && has_term( $my_cat, 'product_cat', $item->id ) ){
                    $bool_cat = true;
                }
            }
            if ( $bool_cat ) {
                $checkout_url = $my_url;
            }
            // This is optional
            else {
                $checkout_url = WC()->cart->get_checkout_url();
            }
        }
        return $checkout_url;
    }

    Thread Starter mastergraphiks

    (@mastergraphiks)

    What i am trying to do is that, if user is from Norway and checkout product is from category cadex, then then checkout page url should change to to default ‘checkout’

    If user is from norway however category is not cadex then the checkout url will be ‘klarna-checkout-page’

    Thread Starter mastergraphiks

    (@mastergraphiks)

    add_filter( 'woocommerce_get_checkout_url', 'krokedil_change_checkout_url', 30 );
    function krokedil_change_checkout_url( $url ) {
    	$allowed_countries = array('NO');
    	$customer_country = WC()->customer->get_default_country();
        if((in_array($customer_country, $allowed_countries )) && (has_term( 'cadex', 'product_cat')) )
            {
    		$url = wc_get_page_permalink( 'checkout' );
    	}
    	return $url;
    }

    This one! treid but not getting cadex category

    Thread Starter mastergraphiks

    (@mastergraphiks)

    i tried has_term but got no luck, can someone do it for me ?

    Thread Starter mastergraphiks

    (@mastergraphiks)

    <?php
    /*
    Plugin Name: Modify Klarna Checkout URL
    Plugin URI: http://krokedil.com
    Description: Change checkout URL for Klarna Checkout if user isn't from a specific country
    Version: 1.0
    Author: Krokedil
    Author URI: http://krokedil.com
    */
    add_filter( 'woocommerce_get_checkout_url', 'krokedil_change_checkout_url', 30 );
    function krokedil_change_checkout_url( $url ) {
    	$allowed_countries = array('NO');
    	$customer_country = WC()->customer->get_default_country();
    	if( !in_array( $customer_country , $allowed_countries ) ) {
    		$url = wc_get_page_permalink( 'checkout' );
    	}
    	return $url;
    }

    Anyone can fix this code so that there could be condition apply that if product belongs to this category in woocommerce then woocommerce checkout url change to the one i will mention ?

    above code do same thing but it do for country, if user not from norway, it will show checkout, otherwise it will show this url klarna-checkout-url.

    I need someone to help me change it to category so that if product is not from this category then show checkout otherwise show klarna-check-url ?

    Thread Starter mastergraphiks

    (@mastergraphiks)

    Well i am using klarna plugin checkout that keep record as well, however it is different checkout page, so there is no problem of record and things, it works just like normal checkout with embeded klarna payment system on the go 🙂

    I just need to put back few products to old checkout so that go to old checkout rather then going to klarna checkout, so just not sure how can i do that for specific category or products.

    Thread Starter mastergraphiks

    (@mastergraphiks)

    So the plugin you are mentioning about just hide and show payments within default checkout page however it does not help to add conditions something like if user select this category product it go to this checkout page.

    Thread Starter mastergraphiks

    (@mastergraphiks)

    Thanks for your response, But here in norway people love to pay through klarna. And if we want to integrate klarna that klarna has a saperate checkout page then the normal checkout page and there is no way to merge two pages. I am able to fix problem using above code so that when users are from norway they will be redirect to klarna checkout page where they are paying and for international people none norwegian will pay through normal checkout page where i am offering them to pay through paypal.

    Now issue is that few products are here in norway are not for people from norway but for people from other countries and i want to redirect people to normal checkout page rather then klarna checkout for specific category or products.

    Thread Starter mastergraphiks

    (@mastergraphiks)

    It will be nice if someone customize the code above for me if he knows ?

    @riaan thanks for your response, how will this plugin add condition so that if user is from norway he will be redirected to saperate klarna check page instead of default checkout page ?

    Thread Starter mastergraphiks

    (@mastergraphiks)

    <?php
    /*
    Plugin Name: Modify Klarna Checkout URL
    Plugin URI: http://krokedil.com
    Description: Change checkout URL for Klarna Checkout if user isn't from a specific country
    Version: 1.0
    Author: Krokedil
    Author URI: http://krokedil.com
    */
    add_filter( 'woocommerce_get_checkout_url', 'krokedil_change_checkout_url', 30 );
    function krokedil_change_checkout_url( $url ) {
    	$allowed_countries = array( 'SE', 'NO', 'FI' );
    	$customer_country = WC()->customer->get_default_country();
    	if( !in_array( $customer_country , $allowed_countries ) ) {
    		$url = wc_get_page_permalink( 'checkout' );
    	}
    	return $url;
    }

    This code helped me somehow to add klarna checkout as alternative option if user is from norway. It redirect to saperate klarna checkout page if user is from norway however is it possible to customize this code so that there are 2 conditions applied for redirection to klarna checkout page.

    1. User is from norway ( that is what already above code doing )
    2. Product categories are ABC, DEF ( For example )

    How can i filter categories as well, so any product within these categories if is selected and user is also from norway will be redirect to klarna checkout page. If he is from norway however select other products that will not defined in above code with categories then the user will go to normal checkpage ?

    Thread Starter mastergraphiks

    (@mastergraphiks)

    i have already done this by using simple wordpress default export plugin and exported all the bookings and then imported them into new blog using wordpress import plugin and all bookings went to correct place 🙂

    Thread Starter mastergraphiks

    (@mastergraphiks)

    yes i checked, have no idea from where this thing is happening!

    mastergraphiks

    (@mastergraphiks)

    Just got update of this plugin, after updated cannot access the admin area as well on frontend website i got this error!

    Warning: include_once(lib/yit-ajax.php) [function.include-once]: failed to open stream: No such file or directory in /xxx/wp-content/plugins/yith-woocommerce-zoom-magnifier/plugin-fw/yit-plugin.php on line 26

    Warning: include_once() [function.include]: Failed opening ‘lib/yit-ajax.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /xxxx/wp-content/plugins/yith-woocommerce-zoom-magnifier/plugin-fw/yit-plugin.php on line 26

    Warning: include_once(lib/yit-plugin-panel-sidebar.php) [function.include-once]: failed to open stream: No such file or directory in /home/facebokms/public_html/wp-content/plugins/yith-woocommerce-zoom-magnifier/plugin-fw/yit-plugin.php on line 27

    Warning: include_once() [function.include]: Failed opening ‘lib/yit-plugin-panel-sidebar.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in xxx/public_html/wp-content/plugins/yith-woocommerce-zoom-magnifier/plugin-fw/yit-plugin.php on line 27

    Thread Starter mastergraphiks

    (@mastergraphiks)

    Thanks for your reply, yes but this is the major feature missed from this nice appointment system. There should be a way to add additional fields, there is custom fields feature as addon with this plugin, but the problem is that this is not hgetting installed, there is asp tag problem or something that is causing the problem, i tried disable the asp_tag from the host and verified it as welll, but still custom fields from the addon is not working. I somehow manage to make custom checkboxs using javascript and push those checkboxes information into the note field so i can have the info like what person want other then the main service from the provider.

    Thread Starter mastergraphiks

    (@mastergraphiks)

    Problem found!

    maybe it help someone else as well! is all because of this plugin rename file to readfile-1.jpg after avatar upload from profile, and some hosts not allow this name as security issue!

Viewing 15 replies - 1 through 15 (of 17 total)