Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter faeryrose

    (@faeryrose)

    It is working perfectly now! Thanks again for addressing this issue so quickly!

    Thread Starter faeryrose

    (@faeryrose)

    On your site, the album is a “simple” product, not a “variation” product. Simple products work on my site also.

    Here is my test site – this is the variable product: https://cthulhumythos.net/shop/variation-product/

    choose an option and add to the cart.

    The Gift Product should also be added to the cart, but it’s not. BUT – if you manually add the gift product to the cart, it will be discounted to $0.00 like it’s supposed to be. Here is the gift product: https://cthulhumythos.net/shop/gift-product/

    Thread Starter faeryrose

    (@faeryrose)

    Thank you for responding so quickly.

    Unfortunately, this is still not working for me with variation products. I have tried on 2 different sites. The option is to define a gift product is there, but it does not automatically add the gift product to the cart. If I manually add the gift product to the cart, it does show up as “free” – but I have to manually add the gift product.

    Thread Starter faeryrose

    (@faeryrose)

    The new settings page works perfectly! Thank you for such a fast response!

    I just installed the plugin but am also getting an error message “Plugin could not be activated because it triggered a fatal error.”

    • This reply was modified 5 years, 7 months ago by faeryrose.
    Thread Starter faeryrose

    (@faeryrose)

    Thank you so much for your reply!

    Sorry – I copied and pasted that code directly from another forum post, and didn’t use the insert code option. I really should have been more thorough – especially when asking others to take the time to help me fix it!

    When I was trying to make this work initially, I had the same thought about the formatting, and tried typing it in from scratch… I did put in the missing single quote in the “add action” line, and removed the semicolons after the domain names and before the commas…but I was never able to make it work. I didn’t think of moving it to the top of the file…

    I ended up getting some help from another developer, who couldn’t figure it out either…but this is what we came up with instead, and it seems to work beautifully (and doesn’t lock me out of the admin side of each domain)

    //REDIRECT CODE 
    
    function country_geo_redirect() {
    	$geo = WPEngine\GeoIp::instance();
    	if ( !current_user_can('administrator') ) {
    	switch ($geo->geos['countrycode']) {
    		case "FR":
    		case "GB":
    		case "DE":
    			if ($_SERVER['HTTP_HOST'] != 'eu.example.com') {
    		  	wp_redirect( 'https://eu.example.com', 301 );
    				exit;
    			}
    			break;
    		case "BN":
    		case "CN":
    		case "JP":
    			if ($_SERVER['HTTP_HOST'] != 'as.example.com') {
    		  	wp_redirect( 'https://as.example.com', 301 );
    				exit;
    			}
    			break;
    		case "AU":
    		case "NZ":
    			if ($_SERVER['HTTP_HOST'] != 'au.example.com') {
    		  	wp_redirect( 'https://au.example.com', 301 );
    				exit;
    			}
    			break;
    		default:
    			if ($_SERVER['HTTP_HOST'] != 'example.com') {
    				wp_redirect( 'https://example.com', 301);
    				exit;
    			}
    	}
    	
    }
    }
    add_action('init', 'country_geo_redirect');

    Also – this may help someone else – but I had to make sure all CDN and Caching was turned off, as that was preventing the changes in the code to “work” for us…

    We couldn’t get the spoof code to work either. Well, it was working a little – using example.com/?geoip&country=FR would redirect to “eu.example.com”, but then it would drop the ?geoip&country=FR part of the URL, and then redirect a second time back to example.com. The if ($_SERVER['HTTP_HOST'] != 'eu.example.com') part of the code seemed to fix this – we could then spoof by going to fr.example.com/?geoip&country=FR, and since we were already at the “correct” url, it wouldn’t “redirect” us anywhere…

    And wrapping the whole switch statement in the if ( !current_user_can('administrator') ) meant I was no longer redirected away from each sub-site even when logged in. (This is a multisite install using subdomains).

    Thank you again for your advice and assistance – and just for simply taking the time to help! I really appreciate it!

    faeryrose

    (@faeryrose)

    That’s awesome! Thank you so much!

    faeryrose

    (@faeryrose)

    I realized this was marked as resolved, but I have a follow up question. You mentioned you could add checkboxes next to each customer, so we could choose who to email? Is this something you are still thinking about implementing? I would find it extremely useful. Thanks!

    What was the solution?

Viewing 9 replies - 1 through 9 (of 9 total)